无法获取属性'字符串'的未定义或null引用IE 11 ASP.NET

Unable to get property 'stringify' of undefined or null reference IE 11 ASP.NET

本文关键字:引用 null IE NET ASP 获取 属性 字符串 未定义      更新时间:2023-09-26

我有一个ajax代码,它接受2个字符串参数,并将这些参数传递给一个后台代码c#方法,该方法更新数据库中的用户记录。

这是我的代码:

                    // Grabs the Customer_ID 
                    <%string inputCust = Session[SessionKey.CUSTOMER_ID].ToString();%>
                    var custNoString = "<%=inputCust%>"
                    // Final input for the password.
                    var finalValue = value2.value;
                    // Create the data object for the 2 parameters for the c# Method
                    var dataObj = {};
                    dataObj.custID1 = custNoString;
                    dataObj.tempPass2 = finalValue;
                        // { "custID1" : custNoString , "tempPass2" : finalValue };
                     // AJAX request to run the function
                     $.ajax({
                         type: "post",
                         url: "reciept.aspx/AddGuestAccount",
                         contentType: "application/json; charset=utf-8",
                         data: JSON.stringify(dataObj),
                         dataType: "json",
                         success: function(){
                             $("#Screen1").hide();
                             $("#Screen2").show(); 
                         },
                         error:function(error){ alert("We are sorry, the action failed. Error: " + error);} 
                     });
                     return true;

现在,当我尝试在IE 11中运行代码时,我会遇到"无法获取未定义或null引用的属性stringify"异常。

有人知道问题出在哪里吗?我正在使用Jquery 1.7,是否需要更新到最新版本?我的ajax代码可能是错误的?

我尝试在IE中使用开发工具进行调试,认为IE 11可能不支持字符串?

让我知道!谢谢

我正在使用这个

 var custNoString = "value1"
    // Final input for the password.
    var finalValue = "value2.value";
    // Create the data object for the 2 parameters for the c# Method
    var dataObj = {};
    dataObj.custID1 = custNoString;
    dataObj.tempPass2 = finalValue;
    $.ajax({
        type: "post",
        url: "about.aspx/diffData",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(dataObj),
        dataType: "json",
        success: function () {
            $("#Screen1").hide();
            $("#Screen2").show();
        },
        error: function (error) { alert("We are sorry, the action failed. Error: " + error); }
    });

在任何浏览器中为我工作