jquery ajax

what is ajax

ajax = asynchronous javascript and xml

the ajax, web applications can send data to, and retrieve data from, a server asynchronously(in the background) without interfering with the display and behavior of the existing page.

on internet number of applications used the ajax technologies.google, facebook .

jquery is a great tool which provides a rich set of ajax method to develop next generation web application.

the jquery library has full suite of ajax capabilities.using jquery ajax support methods we can send , retrieve, load the data from the server without the browser page refresh.


jquery ajax load method

the load() method load data from the server and put the returned html into the matched element.

this method is the simplest way to fetch data from the server.

the jquery load method syntax :-

      $( selector ).load ( url, [data] ,  [callback] );
  • url :- it type string containing the url to which the request is sent.
  • dada :- specifies querystring key/value pairs sent to the server with the request.
  • callback :- this parameter is the name of a function to be executed after the load() method is completed.

the jquery load method example


jquery ajax load() method callback argument

the jquery load() method optional callback parameter indicate a callback function to run when the load() method is completed.

the jquery load() method with callback argument look like

the jquery load method syntax

          $( selector ).load ( url, [data] ,  [ callback (responsetextstatustext,xmlhttprequest) ] );
  • responsetext :- contains the resulting content.
  • statustext :- contains the status of the call.
  • xmlhttpre :- contains the xmlhttprequest object.

The jquery load method example