Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can study about js and ajax here <a href="http://www.w3schools.com/ajax/default.asp" rel="nofollow">http://www.w3schools.com/ajax/default.asp</a> will help a lot. Of course all js functions if called from internal js script should be inside <code>&lt;script&gt;&lt;/script&gt;</code> and if called from external you call the js gile like <code>&lt;script src"somejs.js"&gt;&lt;/script&gt;</code> and inside js there is no need for <code>&lt;script&gt;</code> tags again. Now all those function do not work by simply declaring them. So this:</p> <pre><code>function sayHello(){ alert("Happy coding"); } </code></pre> <p>doesn't work because it is just declared and not called into action. So in jQuery that you use after we declare some functions as the sayHello above we use:</p> <pre><code>jQuery(document).ready(function($){ sayHello(); }); </code></pre> <p>Doing this we say that when everything is fully loaded so our DOM has its final shape then let the games begin, make some DOM manipulations etc</p> <p>Above also you don't specify the type of your call meaning <code>POST</code> or <code>GET</code>. Those verbs are the alpha and omega of http requests. Typically we use <code>GET</code> to bring data like in your case here and <code>POST</code> to send some data for storage to the server. A very common <code>GET</code> request is this:</p> <pre><code> $.ajax({ type : 'GET', url : someURL, data : mydata, //optional if you want to send sth to the server like a user's id and get only that specific user's info success : function(data) { console.log("Ajax rocks"); }, error: function(){ console.log("Ajax failed"); } }); </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