1: A domain server-side output JSON 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: "// Www.testB.com/cronemail/cron_expressmail.php?orderingid=2222 ", Cache:false, dataType:" Jsonp ", Jsonp:" Callbackfun ", Jsonpcallback:" Jsonpcallback ", success:function (JSON) {alert (json.message);}})}
But the page tip 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.4506.2152;. NET CLR 3.5.30729)
Timestamp: Tue, Oct 10:48:39 UTC
Message: Script Error
Line: 0
Character: 0
Code: 0
uri:http://www.test.com/cronemail/cron_expressmail.php?orderingid=2222&callbackfun=jsonpcallback&_= 1382438914750
Reply to discussion (solution)
Ajax can't cross domain, that's the fact that it's indisputable
Your code is only a formal cross-domain and is actually
So the URL must return a valid JS statement
Just a JSON string is not enough.
$test = "{name:\" john\ ", message:\" Hello john\ "}"; Echo $_get[' Callbackfun ']. ' ('. $test. ') ';