Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It seems that you are using simple javascript to send the ajax request it is much easier with <code>jQuery</code>. You do not have to check the browsers and many other things are simplified in jQuery. Now for the flow part.</p> <p>1.An event has to occur as to trigger the ajax request. It can be anything like blur,focus,click,load,mouseout,mousein its your choice. code might look like this;</p> <pre><code>$($btn).click(function(){ insert your ajax request here }) </code></pre> <p>This says that the button has been clicked</p> <p>2.call an ajax.</p> <pre><code> $.ajax({ url : "phpFile.php", data : dataYouwantToSend, success: function() { code to do if the call is successful } }) </code></pre> <p>3.process the data in php file</p> <p>in <code>phpFile.php</code></p> <p>whatever you echo or print in the php file is going to show up as response from the file.</p> <p>for example if your php file only contain</p> <pre><code>echo "hello world"; </code></pre> <p>response to your ajax request would be just <code>hello world</code>.</p> <p>4.process the response in <code>ajax success function</code></p> <pre><code>success : function (response){ //the variable in the function can be anything alert(response); } </code></pre> <p>above example will <code>alert hello world</code></p> <p>the whole code would look like this. this is the html file.</p> <pre><code>&lt;input type="text" id="clickMe" /&gt; &lt;script src="ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(function(){ $("#clickMe").click(function(){ $.ajax({ url : "phpFile.php", success : function(res) { alert(res); } }) }) }) &lt;/script&gt; </code></pre> <p>this is the php file phpFile.php</p> <pre><code>echo "Hello world"; </code></pre>
    singulars
    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.
    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