jQuery Tutorial Tutorials - jQuery load()

jQuery load()

The load() method in jQuery is used to load data from the server and place the returned HTML into the matched elements.

jQuery load() syntax

load( url [, data ] [, complete ] )
Parameter Type Description
url String request url
data PlainObject,String The data sent to the server
complete Function callback function that is executed when the request completes.

jQuery load() example

example

Load another page's list items into an ordered list.

HTML

<b>jQuery Links:</b>
<ul id="links"></ul>

jQuery

$("#links").load("/Main_Page #p-Getting-Started li");

example

Load the content of the file feeds.html
jQuery

$("#feeds").load("feeds.html");

example

POST the additional parameters to the server and a callback that is executed when the server is finished responding.

jQuery

$( "#feeds" ).load( "feeds.php", { limit: 25 }, function() {
  alert( "The last 25 entries in the feed have been loaded" );
});
Date:2019-08-30 03:02:28 From:www.Lautturi.com author:Lautturi