开发者

$.ajax() control does not enter success or failure but fire bug console i am getting the json response ok

The following is the json response

{"d":[{"__type":"Treking.Data.Users.Owner","MembershipId":null,"FirstName":"siva","MobileNo":"9886811237","EmailId":"user@gmail.com","PhoneNo":""}]}

Client Side js is as follows

function GetInfo() {

        var checkboxInfo = $('#&lt%= chkboxContact.ClientID %&gt');
       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 &lt str.length; i++) {
                    var firstname = str[i].FirstName;
                    var MobileNo = str[i].Mo开发者_如何转开发bileNo;
                    var EmailId = str[i].EmailId;
                    var PhoneNo = str[i].PhoneNo;
                }
                $('#&lt%=txtboxContactperson.ClientID %&gt').text = firstname;
                $('#&lt%=txtboxEmailId.ClientID %&gt').text = EmailId;
                $('#&lt%=txtboxMobileNo.ClientID %&gt').text = MobileNo;
                $('#&lt%=txtboxTelephone.ClientID %&gt').text = PhoneNo;

            }, failure: function (response) {
                alert(response.d + "FAILED");
            }
        });



       }
    }

i have a asp.net checkbox with an id of chkboxContact onchange i call this javascript function. but the control jumps of the success and it does not enter it ,the control from sucess jumps to failure but does not enter the failure function.Please Guide


Thanks for the quick response but I am still the problem is not solved after I used

error: function(XMLHttpRequest, textStatus, errorThrown) {  
   alert("Status: " + textStatus); alert("Error: " + errorThrown); 
} 

it still does not enter success or failure


Like Nick Craver said, there is no failure function, only error. Note that if the call errors, it will never enter the success function, only the error result will be returned.

error: function(XMLHttpRequest, textStatus, errorThrown) { 
   alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜