<tfoot id='K0I2j'></tfoot>

        • <bdo id='K0I2j'></bdo><ul id='K0I2j'></ul>
        <legend id='K0I2j'><style id='K0I2j'><dir id='K0I2j'><q id='K0I2j'></q></dir></style></legend>

        <i id='K0I2j'><tr id='K0I2j'><dt id='K0I2j'><q id='K0I2j'><span id='K0I2j'><b id='K0I2j'><form id='K0I2j'><ins id='K0I2j'></ins><ul id='K0I2j'></ul><sub id='K0I2j'></sub></form><legend id='K0I2j'></legend><bdo id='K0I2j'><pre id='K0I2j'><center id='K0I2j'></center></pre></bdo></b><th id='K0I2j'></th></span></q></dt></tr></i><div id='K0I2j'><tfoot id='K0I2j'></tfoot><dl id='K0I2j'><fieldset id='K0I2j'></fieldset></dl></div>

        <small id='K0I2j'></small><noframes id='K0I2j'>

      1. $.ajax 调用在 IE8 中运行良好,但在 Firefox 和 chrome 浏览器中不起作用

        $.ajax call working fine in IE8 and Doesn#39;t work in firefox and chrome browsers($.ajax 调用在 IE8 中运行良好,但在 Firefox 和 chrome 浏览器中不起作用)

                <tbody id='sqqnR'></tbody>
              • <tfoot id='sqqnR'></tfoot>
                <legend id='sqqnR'><style id='sqqnR'><dir id='sqqnR'><q id='sqqnR'></q></dir></style></legend>
                <i id='sqqnR'><tr id='sqqnR'><dt id='sqqnR'><q id='sqqnR'><span id='sqqnR'><b id='sqqnR'><form id='sqqnR'><ins id='sqqnR'></ins><ul id='sqqnR'></ul><sub id='sqqnR'></sub></form><legend id='sqqnR'></legend><bdo id='sqqnR'><pre id='sqqnR'><center id='sqqnR'></center></pre></bdo></b><th id='sqqnR'></th></span></q></dt></tr></i><div id='sqqnR'><tfoot id='sqqnR'></tfoot><dl id='sqqnR'><fieldset id='sqqnR'></fieldset></dl></div>

                  <bdo id='sqqnR'></bdo><ul id='sqqnR'></ul>
                • <small id='sqqnR'></small><noframes id='sqqnR'>

                  本文介绍了$.ajax 调用在 IE8 中运行良好,但在 Firefox 和 chrome 浏览器中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  这是我的代码

                  $.ajax(
                  {
                      type: "GET", 
                      url: 'http://devserver:7995/stdpart/services/GetAllPartsWithFilter',
                      dataType: 'json',
                      data: jsonPartsData,
                      success: fnGetPartsData, 
                      error: PartsLoadError  
                  });
                  

                  这是代码在 IE8 中运行良好,但在 Firefox 和 Chrome 浏览器中运行失败.当我检查 XHR 对象时,它表示状态代码为 0.我检查了所有其他问题,但没有一个问题能帮助我识别问题.

                  This is code working fine in IE8, But getting failed in Firefox and Chrome browsers. When i, inspect the XHR object, it's saying the status code code is 0. I have checked all other questions, none of them are helped me to identify the issue.

                  如果我在这段代码中做错了什么,请告诉我.如果 $.ajax 有一些兼容性问题,那么请提出与之等效的建议.

                  Let me know, if i am doing any thing wrong in this code. If $.ajax has some compatibility issues, then please suggest something equivalent to it.

                  更新:我们在以下位置找到了一种解决方案http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html

                  Update: We found one solution at http://www.xml.com/pub/a/2005/12/21/json-dynamic-script-tag.html

                  它使用了动态脚本的概念.我们在我们的应用程序中做了同样的事情,然后每件事现在似乎都在工作.还是要全面分析.

                  It is using the concept of Dynamic Scripting. We have done the same thing in our application, then every thing seems to be working now. Yet to analyze fully.

                  推荐答案

                  这是因为 同源政策.您不能使用 ajax 调用外部站点.如果你真的想使用,你必须使用 JSONP.或者您可以为此使用服务器端代理.意思是,在服务器端调用外部站点并对那个 web 服务进行 ajax 调用.

                  this is because of the Same origin policy. you cannot use ajax to call external sites. if you really want to use, you have to use JSONP. Or you can use serverside proxy for this. means, call external site in the server side and do ajax call to the that webservice.

                  更新:

                  在您的网站中创建 webserviceice,并在 webmethod 中输入以下代码

                  create webserveice in your site and in the webmethod put following code

                  string proxyURL = "http://devserver:7995/stdpart/services/GetAllPartsWithFilter";
                  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(proxyURL);
                  request.Method = "GET";
                  HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                  
                  if (response.StatusCode.ToString().ToLower() == "ok")
                  {
                      Stream content = response.GetResponseStream();
                      StreamReader contentReader = new StreamReader(content);         
                      return contentReader.ReadToEnd();
                  }
                  return string.Empty;
                  

                  然后使用您的代码访问本地服务.

                  then access local service using your code.

                  更多信息请参考这个链接

                  这篇关于$.ajax 调用在 IE8 中运行良好,但在 Firefox 和 chrome 浏览器中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
                  XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
                  Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
                  How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
                  How do I get the HTTP status code with jQuery?(如何使用 jQuery 获取 HTTP 状态码?)
                  How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)
                • <small id='GUt86'></small><noframes id='GUt86'>

                    <bdo id='GUt86'></bdo><ul id='GUt86'></ul>

                      • <tfoot id='GUt86'></tfoot>
                        <i id='GUt86'><tr id='GUt86'><dt id='GUt86'><q id='GUt86'><span id='GUt86'><b id='GUt86'><form id='GUt86'><ins id='GUt86'></ins><ul id='GUt86'></ul><sub id='GUt86'></sub></form><legend id='GUt86'></legend><bdo id='GUt86'><pre id='GUt86'><center id='GUt86'></center></pre></bdo></b><th id='GUt86'></th></span></q></dt></tr></i><div id='GUt86'><tfoot id='GUt86'></tfoot><dl id='GUt86'><fieldset id='GUt86'></fieldset></dl></div>

                          • <legend id='GUt86'><style id='GUt86'><dir id='GUt86'><q id='GUt86'></q></dir></style></legend>
                              <tbody id='GUt86'></tbody>