Home  >  Article  >  Backend Development  >  php+jquery跨域提交有关问题,别嫌弃啊只有20分了

php+jquery跨域提交有关问题,别嫌弃啊只有20分了

WBOY
WBOYOriginal
2016-06-13 12:35:07904browse

php+jquery跨域提交问题,别嫌弃啊只有20分了
1:A域服务器端输出json如下

<br />
$test = "{name:\"John\", message:\"hello John\"}";<br />
echo $test;<br />

2:B域服务端程序如下
<br />
function sendEmail() {<br />
	var orderingId = $("#orderingId").val();<br />
	 alert(orderingId);<br />
	 $.ajax({<br />
		 type: "get",<br />
		 url:"http://www.testB.com/cronemail/cron_expressmail.php?orderingid=2222",<br />
		 cache : false, <br />
		 dataType : "jsonp",<br />
		 jsonp: "callbackfun",<br />
		 jsonpCallback:"jsonpCallback",<br />
                 success:function (json) {<br />
			alert(json.message);<br />
		}<br />
	 })<br />
}<br />

可是页面提示错误:
用户代理: 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)
时间戳: Tue, 22 Oct 2013 10:48:39 UTC


消息: Script error
行: 0
字符: 0
代码: 0
URI: http://www.test.com/cronemail/cron_expressmail.php?orderingid=2222&callbackfun=jsonpCallback&_=1382438914750

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn