【问题标题】:How do I make a Cross-Domain Request in Firefox?如何在 Firefox 中发出跨域请求?
【发布时间】:2015-03-17 18:09:01
【问题描述】:

我正在使用以下 jQuery AJAX 调用来访问 SOAP Web 服务:

jQuery.ajax({    
    url: url,    
    type: "GET",             
    dataType: "jsonp text",
    crossDomain :true,
    data:"i="+'a'+"&j="+'b',
    processData: false, 
    success: OnSuccess,       
    error: OnError      
}); 

此代码在 IE 中运行良好,但在 Firefox 中得到空响应。进一步搜索,Firefox 似乎默认不允许跨域请求,或者它以不同的方式处理标头信息。

我的应用程序在localhost:8081 上,而我要使用的WebService 在localhost:8080 上。有什么方法可以让 Firefox 发出跨域请求?

【问题讨论】:

  • 你检查过firebug的输出吗
  • 是的,我检查了,响应是“”

标签: firefox jquery cross-domain


【解决方案1】:
【解决方案2】:

是的,这个问题在我为 firefox 安装 CORS 插件后得到解决。但是有没有其他方法,我可以使用 JQuery-ajax 代码设置参数?

【讨论】:

    【解决方案3】:

    您需要发送与 OPTIONS 请求响应中相同的“Access-Control-####”标头。

    【讨论】:

      猜你喜欢
      • 2011-01-25
      • 1970-01-01
      • 2012-12-15
      • 2016-10-06
      • 1970-01-01
      • 2018-04-12
      • 1970-01-01
      • 2012-02-26
      • 2016-01-29
      相关资源
      最近更新 更多