Several ways that Ajax requests general handler parameter passing

Source: Internet
Author: User

The first type of Ajax request
$.ajax ({type: "GET",//request type, Get,post type, and form submission are the same
URL: "Result.aspx",//request processing of the page, that is, the page captures the request, the same path can be changed to ASHX, the general processing program
Data: "Name=john&location=boston",//pass parameters, it is (Result.aspx?name=john&loaciton=boston)
Success:function (msg) {///Request success will be handled by this method, where the request for a successful return value is received by MSG $ ("#ajaxDIV"). Text (msg);}});
Second kind of request
$.get (//Using GET request mode, is actually the variant of the previous one
"Handler.ashx",
{name: "Dumb Bear", Sex: "Female"},
The parameter to pass resolves to (handler.ashx?name= &sex=) function (msg) {//Request return parameter $ ("#Div1"). Text (msg);});
Third Kind of request
$.post (//The previous type of the request is the same, but the request is in a different way
"Handler2.ashx",
{name: "Benben stupid Bear", sex: "Female"},
Function (msg) {
$ ("#Div2"). Text (msg); } );

Several ways that Ajax requests general handler parameter passing

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.