我有以下问题.我的webapp正在运行
http://webapp.mysite.com/browser/
我想提出要求
http://mysite.com/request?....
如果我使用第二个url进行标准的ajax调用,我会收到一条错误消息,即域(同源)策略错误.
[object Object]-error-[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: ..../scripts/jquery/js/jquery-1.4.4.min.js :: anonymous :: line 16" data: no]
现在我尝试了this ajax php proxy来解决我的问题.但脚本不返回任何内容.
var app = 'http://www.mysite.com/rest.PHP?request=credits'; var proxy = 'proxy.PHP?proxy_url=' + app; $.ajax({ url: proxy,cache: false,async: false,dataType: 'html' success: function(html){ alert(html); },error: function(){ } });
有任何想法吗?
解决方法
啊,也许这就是问题所在:
http://api.jquery.com/jQuery.ajax/
“跨域请求和dataType:”jsonp“请求不支持同步操作.”
你说,你将使用跨域请求,因此你不能将async设置为false.请尝试使用async = true并提供反馈.
啊,你收到一条空内容的提醒信息吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。