Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The jQuery documentation actually gives an example almost identical to your problem:</p> <p><a href="http://api.jquery.com/jQuery.get/" rel="nofollow">http://api.jquery.com/jQuery.get/</a></p> <pre><code>$.get('ajax/test.html', function(data) { $('.result').html(data); alert('Load was performed.'); }); </code></pre> <p>This will get an html page and insert it under an html element with class 'result'.</p> <p>You should be able to replace your php script url and specify where the output should be displayed.</p> <p>If youre worried about conflicts with other jQuery instances, have a read of this: <a href="http://api.jquery.com/jQuery.noConflict/" rel="nofollow">http://api.jquery.com/jQuery.noConflict/</a></p> <p>If you want to write your own AJAX handler check out this page : <a href="https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest" rel="nofollow">https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest</a></p> <p>Essentially you will do something like this (taken from the link):</p> <pre><code>function reqListener () { console.log(this.responseText); }; var oReq = new XMLHttpRequest(); oReq.onload = reqListener; oReq.open("get", "yourFile.txt", true); oReq.send(); </code></pre> <p>I think its worth doing if you've never had to do it before, but you will open yourself up to lots of potential problems that have been solved for you.</p> <p>Ideally if I were doing this I would return json from the handler and allow the user to decide how to display it, but thats your call.</p>
 

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