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