This is another example in the series of jQuery: By Examples. In this example I will load data from one of the posts. Instead of loading complete post (including title) I will load data from a specific portion of the page. Following functions/methods are used in this example:
- .load( url, [ data ], [ complete(responseText, textStatus, XMLHttpRequest) ] )
- .hide()
- .appendTo()
- slideDown()
.load() method is the simplest way to get data from the server. Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol. Using the special syntax for url, you can get data from specif portion of the remote document. If the url has one or more spaces, the portion of the string following the first space is assumed to be a jQuery selector that determines the content to be loaded. For example:
- .load('http://myerrorslog.blogspot.com/2006/12/introduction.html div[class="post-body entry-content"]')
No comments:
Post a Comment