Jsonp cross-origin access and jsonp cross-origin access

Source: Internet
Author: User

Jsonp cross-origin access and jsonp cross-origin access

$. Ajax ({
Type: "get ",
Url: "http://liuy.cuour.org/Home/Nsave ",
Data: {"UName": UName, "Tel": Tel, "RegisterUrl": RegisterUrl, "ProvinceID": ProvinceID, "Mtype": Mtype, "TalkProJectID": TalkProJectID, "RegisterID": RegisterID },
DataType: 'jsonp ',
Jsonp: "_ jsonpCallback ",
Success: function (json ){
If (json. id = 1 ){
Alert ("congratulations, submission successful! ");
Return false;
}
If (json. id = 2 ){
Alert ("the mobile phone number cannot be submitted again ");
Return false;
}
Else {
Alert ("submission failed! ");
}
}
});

Currently, jsonp does not support post cross-origin requests.

Background receiving method:

String jsonpCallback = Request. QueryString ["_ jsonpCallback"];

To return successful data, add jsonpcallback:

Return Content (jsonpCallback + "({id:" + 1 + "});");

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.