以下是json响应
{"d":[{"__type":"Treking.Data.Users.Owner","MembershipId":null,"FirstName":"siva","MobileNo":"9886811237","EmailId":"user@gmail.com","PhoneNo":""}]}客户端js如下所示
function GetInfo() {
        var checkboxInfo = $('#<%= chkboxContact.ClientID %>');
       var domcheckboxInfo=  checkboxInfo[0];
       if (domcheckboxInfo.checked == true) {
           $.ajax(
        {
            type: "Post",
            url: "../ProfileService.asmx/GetUserInfo",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (response) {
                var str = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
                for (var i = 0; i < str.length; i++) {
                    var firstname = str[i].FirstName;
                    var MobileNo = str[i].MobileNo;
                    var EmailId = str[i].EmailId;
                    var PhoneNo = str[i].PhoneNo;
                }
                $('#<%=txtboxContactperson.ClientID %>').text = firstname;
                $('#<%=txtboxEmailId.ClientID %>').text = EmailId;
                $('#<%=txtboxMobileNo.ClientID %>').text = MobileNo;
                $('#<%=txtboxTelephone.ClientID %>').text = PhoneNo;
            }, failure: function (response) {
                alert(response.d + "FAILED");
            }
        });
       }
    }我有一个asp.net复选框,它的id为chkboxContact onchange,我称之为javascript函数。但是控制跳跃的成功,它没有进入它,控件从成功跳转到失败,但没有进入失败function.Please指南。
谢谢你的快速反应,但我仍然没有解决问题后,我使用
error: function(XMLHttpRequest, textStatus, errorThrown) {  
   alert("Status: " + textStatus); alert("Error: " + errorThrown); 
} 它仍然没有进入成功或失败。
发布于 2010-07-19 15:48:57
就像尼克·克雷弗说的,没有故障函数,只有错误。注意,如果调用错误,它永远不会输入成功函数,只会返回错误结果。
error: function(XMLHttpRequest, textStatus, errorThrown) { 
   alert("Status: " + textStatus); alert("Error: " + errorThrown);
}https://stackoverflow.com/questions/3282165
复制相似问题