Ajax usage of jQuery Summary

Source: Internet
Author: User
Some people say that jQuery can make js programming very elegant and I have never believed it, because I have always used prototype development.
I learned about jQuery today and it seems that it can really be elegant.

// If you want to publish this article, please indicate the exit, no outgoing copyright notice, I do not like to see this kind of website. My work website does not indicate the person who is serving Seven {See7di # Gmail.com}

Use the get method to send data to test. php: Two response data records at the same time. The response function shows the outbound content of the server. The php client uses $ _ GET ["name"] to obtain the response data.
$. Get ("test. php", {name: "John1", time: "2"}, function (msg ){
Alert ("Data Saved:" + msg );
});

Use the post method to send data to test. php: Two response data records at the same time. The response function shows the outbound content of the server. The php client uses $ _ POST ["name"] to obtain the response data.
$. Post ("test. php", {name: "John2", time: "2"}, function (msg ){
Alert ("Data Saved:" + msg );
});

Use the post method to send data to test. php: Two response data records at the same time. The response function shows the outbound content of the server. The php client uses $ _ POST ["name"] to obtain the response data.
$. Ajax ({
Type: "POST ",
Url: "test. php ",
Data: "name = Jing & location = Boston ",
Success: function (msg ){
Alert ("Data Saved:" + msg );
}
});

Load JSON data using http get requests
$. GetJSON ("test. php? Name = Jing 1 & location = Boston ", function (data ){
Alert ("Data Saved:" + data );
});

Load and execute a JavaScript file through an http get request
$. GetScript ("custom. js", function (data ){
Alert ("Data Saved:" + data );
});

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.