Php + jquery Cross-Origin submission problem. don't give up. it's only 20 points.-php Tutorial

Source: Internet
Author: User
Tags domain server
Php + jquery Cross-Origin submission problem. don't give up. it's only 20 points. 1: The output of json on the server side of domain A is as follows:
$test = "{name:\"John\", message:\"hello John\"}";echo $test;

2: The B-domain server program is as follows:
function sendEmail() {var orderingId = $("#orderingId").val(); alert(orderingId); $.ajax({ type: "get", url:"http://www.testB.com/cronemail/cron_expressmail.php?orderingid=2222", cache : false,  dataType : "jsonp", jsonp: "callbackfun", jsonpCallback:"jsonpCallback",                 success:function (json) {alert(json.message);} })}

However, the page prompts an error:
User agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SV1;. net clr 2.0.50727;. net clr 3.0.20.6.2152;. net clr 3.5.30729)
Timestamp: Tue, 22 Oct 2013 10:48:39 UTC


Message: Script error
Row: 0
Character: 0
Code: 0
URI: http://www.test.com/cronemail/cron_expressmail.php? Orderingid = 2222 & callbackfun = jsonpCallback & _ = 1382438914750


Reply to discussion (solution)

Ajax cannot cross-origin. this is an indisputable fact.
Your code is only a form of cross-origin, in fact

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.