首页 > IE script5 拒绝访问

IE script5 拒绝访问

    function cPost(url, params, paramValue) {
        if ((navigator.userAgent.indexOf("MSIE 8.0") > 0 || navigator.userAgent.indexOf("MSIE 9.0")) && window.XDomainRequest) {
            var xdr = new XDomainRequest();
            url += "IE89/?id=" + paramValue;
            //xdr.contentType = "text/plain";
            xdr.onload = function () {
                var data = $.parseJSON(xdr.responseText);
                console.log(data)
                if (data.state == "OK") {
                    layer.alert('您已预约成功!', { icon: 1 });
                    $("#txtUserName").val("");
                    $("#txtPhone").val("");
                    $("#txtDate").val("");
                } else {
                    layer.alert('预约失败!', { icon: 2 });
                }
            };
            xdr.onerror = function (e) {
                console.log("error")
                console.log(e)
            }
            xdr.timeout=10000;
            xdr.open("POST", url);
            xdr.send(); 
        }
        else {
            $.post(url, params, function (data) {
                if (data.state == "OK") {
                    layer.alert('您已预约成功!', { icon: 1 });
                    $("#txtUserName").val("");
                    $("#txtPhone").val("");
                    $("#txtDate").val("");
                } else {
                    layer.alert('预约失败!', { icon: 2 });
                }
    
            });
        }
    }

最后又换了一种方式 用了一个 jquery.xdomainrequest.min.js插件

function IEPost(Url, params, paramValue){
        $.ajax({
            url: Url,
            data: params,
            type: 'POST',
            dataType: 'json',
               success:function(data){
                   if (data.state == "OK") {
                    layer.alert('您已预约成功!', { icon: 1 });
                    $("#txtUserName").val("");
                    $("#txtPhone").val("");
                    $("#txtDate").val("");
                } else {
                    layer.alert('预约失败!', { icon: 2 });
                }
               },
               error:function(e){
                   console.log(e)
               }
          })
    }

IE9 提示{readyState: 4, responseText: "", status: 500, statusText: "error"}

【热门文章】
【热门文章】