Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery/ajax doesnot work
    text
    copied!<p>For some reason this does not work. I have copy/paste the code, but it goes to the <strong>html-echo.php</strong> rather than displaying the result in the <strong>htmlExampleTarget</strong></p> <p>What am I doing wrong here.</p> <p>Thanks</p> <p>Dave</p> <p><strong>edit:</strong> sorry guys - here is the url - <a href="http://jquery.malsup.com/form/#html" rel="nofollow noreferrer">http://jquery.malsup.com/form/#html</a></p> <pre><code> &lt;script src="js/jquery-1.3.2.js" type="text/javascript" language="javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // prepare the form when the DOM is ready $(document).ready(function() { // bind form using ajaxForm $('#htmlForm').ajaxForm({ // target identifies the element(s) to update with the server response target: '#htmlExampleTarget', // success identifies the function to invoke when the server response // has been received; here we apply a fade-in effect to the new content success: function() { $('#htmlExampleTarget').fadeIn('slow'); } }); }); &lt;/script&gt; &lt;div style="position:absolute; top:129px; left: 400px; width:500px; border:#000000 thin solid;"&gt; &lt;form id="htmlForm" action="submit_form.php" method="post"&gt; Message: &lt;input type="text" name="message" value="Hello HTML" /&gt; &lt;input type="submit" value="Echo as HTML" /&gt; &lt;/form&gt; Reply: &lt;div id="htmlExampleTarget"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>and on the submit-form.php page </p> <pre><code>echo '&lt;div style="background-color:#ffa; padding:20px"&gt;' . $_POST['message'] . '&lt;/div&gt;'; </code></pre>
 

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