Note that there are some explanatory texts on larger screens.

plurals
  1. POGet div content with jQuery for PHP
    primarykey
    data
    text
    <p><strong>UPDATE</strong>: Wow that was the fastest response ever and so many answers in minutes of each other. Amazing. Ok here is what I am trying to do. <a href="http://edvizenor.com/invoice33/" rel="nofollow">http://edvizenor.com/invoice33/</a></p> <p>I want to edit this invoice on the fly but when I hit the BLUE BOX at the top I want to preview or see this content on the next page contained php var echoed out. </p> <p>This blue box will change later to be a button at the bottom but for testing I am using it. </p> <p>As you see it calls the ajax script but I need the edited content of the div to be sent a php var to I can echo it on the preview page. If I can put it in a php var I do what I will with it on the next page. Does that make sense? Thanks guys for your quick responses.</p> <h2>OLD POST</h2> <p>Is it possible to get the contents of a <code>div</code> using jQuery and then place them in a PHP var to send via GET OR POST?</p> <p>I can get the contents of the <code>div</code> with jQuery like this:</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() { $("#MyButton").click(function() { var htmlStr = $("#MyDiv").html(); }); }); &lt;/script&gt; </code></pre> <p>But how do I put the jQuery var in a php var. I need to do this by a BUTTON press too. This is not included in the code above. I need because the <code>div</code> file is changeable and when I hit UPDATE and send via PHP it needs to have the latest content.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload