Load (URL, [data], [callback])

Source: Internet
Author: User
Document directory
  • Overview
  • Parameters
  • Description:
Overview

Load the remote HTML file code and insert it into the Dom.

By default, the get method is used. The method is automatically converted to the post mode when additional parameters are passed. In jquery 1.2, you can specify a selector to filter loaded HTML documents. In Dom, only filtered HTML code is inserted. The syntax is like "url # Some> selector ". See the example.

Parameters URLString

The URL of the HTML webpage to be loaded.

Data(Optional)Map, string

Key/value data sent to the server. In jquery 1.3, you can also accept a string.

Callback(Optional)Callback

Callback function when loading is successful.

Description:

Load the navigation part of the article sidebar to an unordered list.

HTML code:
<B> jquery links: </B> <ul id = "Links"> </ul>
Jquery code:
$ ("# Links"). Load ("/main_page # P-getting-started li ");
Description:

Load the content of the feeds.html file.

Jquery code:
$ ("# Feeds"). Load ("feeds.html ");
Description:

Same as above, but the additional parameters are sent in post form and the information is displayed when the request is successful.

Jquery code:
$ ("# Feeds "). load ("feeds. PHP ", {limit: 25}, function () {alert (" the last 25 entries in the feed have been loaded ");});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.