Thursday, October 25, 2012

jQuery Load Method

jQuery provides various methods like ajax, load, get, post, getJSON, getJSON etc  to make an Ajax call. In this post we shall see on how to use the load() method to make an Ajax call.

The load() method is used to load HTML data from the server directly into elements in the page like DIV, Table etc

The Syntax for the load() method is as follows.
load("<server page>",<POST request data (Optional)>,completeHandlerFunction());

We can also pass the ID of a specific element in the resultant HTML data to load only the HTML tags specific to the element. This allows loading only a part of the response HTML by passing the specific ID. For this we need to append the ID to the request URL as follows.



$("#divParticalResponse").load("AjaxData.html#tblContact");

This will load the content of the element tblContact into the DIV tag divParticalResponse


Related Post
jQuery Load Method
jQuery Load GET Request Example
jQuery Load POST Request Example
jQuery Load HTML Response Example
jQuery Load Text Response Example
jQuery Load Specific HTML Element from Response
jQuery Load Partial HTML Response Example



Search Flipkart Products:
Flipkart.com

No comments: