weixin_33696822 2013-11-14 18:07 采纳率: 0%
浏览 36

AJAX请求仅使IE失败

The following ajax call works just fine in Chrome/FF, but is failing in IE only. I've tried turning cache off, physical/relative paths, async on and off, but not having any luck. I've been cruising around in SO all morning finding and testing different solutions, but I'm still not having any luck.

The error code returned isn't terribly helpful: error undefined

Any Ideas?

function CreateCard(//a bunch of paramaters//){



                var soapMessage ='//big long soap string goes here//';          
                var webServiceURL="//consumption URL (relative)";


                $.ajax({
                    url: webServiceURL, 
                    type: "POST",
                    crossDomain: true,
                    dataType: 'xml',
                    data: soapMessage, 
                    processData: false,
                    contentType: "text/xml; charset=\"utf-8\"",
                    success: function(data, status, req, xml, xmlHttpRequest, responseXML) { 
                        var newCardID=$(req.responseXML).find('AddeCardRequestResult').text();  //Fetches new card id
                        $('div#debug').html("success: " + newCardID)  
                        $('#CID').val(newCardID);

                        __doPostBack('btnSubmit', newCardID);

                    }, 
                    error: function(xhr, msg) { 
                        $('div#debug').html(msg + '
' + xhr.responseText)
                    } 
                });




            }
  • 写回答

2条回答

  • weixin_33738578 2013-11-14 18:15
    关注

    With ie you'll need to append some kind of random parameter to your request.

    I typically use something like (new Date()).getTime() as the value for a parameter name that is not used by the remote application.

    This will trick ie into thinking it's a new request every time.

    Edit: Found a similar question adding link.

    This answer does a better job of explaining it than I do, it also has a jquery solution included. (copied from the linked answer so credit goes there.)

    $.ajaxSetup({ cache: false });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog