

Here is the simple syntax for getJSON() method −. JQuery utility function getJSON() parses the returned JSON string and makes the resulting string available to the callback function as first parameter to take further action. There would be a situation when server would return JSON string against your request. When you click the given button, then result.html file gets loaded. Assuming, our /jquery/result.html file has just one HTML line − After loading this file, all the content would be populated inside tagged with ID stage. Here load() initiates an Ajax request to the specified URL /jquery/result.html file. The first parameter passed to this function is the response text received from the server and second parameter is the status code.Ĭonsider the following HTML file with a small JQuery coding −Ĭlick on the button to load /jquery/result.html file − If omitted, the GET method is used.Ĭallback − A callback function invoked after the response data has been loaded into the elements of the matched set. If specified, the request is made using the POST method. It could be a CGI, ASP, JSP, or PHP script which generates data dynamically or out of a database.ĭata − This optional parameter represents an object whose properties are serialized into properly encoded parameters to be passed to the request. URL − The URL of the server-side resource to which the request is sent. Here is the description of all the parameters − Here is the simple syntax for load() method −. JQuery provides load() method to do the job − Syntax This is very easy to load any static or dynamic data using JQuery AJAX. JQuery is a great tool which provides a rich set of AJAX methods to develop next generation web application. If you are new with AJAX, I would recommend you go through our Ajax Tutorial before proceeding further. AJAX is an acronym standing for Asynchronous JavaScript and XML and this technology helps us to load data from the server without a browser page refresh.
