$.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 = $('#<%= 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].Mo开发者_如何转开发bileNo;
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");
}
});
}
}
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);
}
精彩评论