开发者

$.ajax Working in Firefox but not in IE

I have a checkbox server control called chkboxContact. on check iam populating the Jason data into the textbox its working fine in Firefox but not in IE.Please Suggest .Thanks

<script type="text/javascript">
 function GetInfo() {

     var checkboxInfo = $('#ctl00_PlaceHolderCenter1_chkboxContact');
     var domcheckboxInfo = checkboxInfo[0];
    if (domcheckboxInfo.che开发者_运维问答cked == true) {


    GetUserInfo();

    }
    else {
        document.getElementById("ctl00_PlaceHolderCenter1_txtboxContactperson").value = "";
        document.getElementById("ctl00_PlaceHolderCenter1_txtboxMobileNo").value = "";
        document.getElementById("ctl00_PlaceHolderCenter1_txtboxEmailId").value = "";
        document.getElementById("ctl00_PlaceHolderCenter1_txtboxTelephone").value = "";
        }
}

 function GetUserInfo() {

        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "../ProfileService.asmx/GetUserInfo",
                            async: false,
             data: "{ }", // send an empty object for calls with no parameters
            dataType: "json",
            success: displayUserInfo,
             failure: reportError
            });



  }


 function displayUserInfo(response) {

var firstname;
var MobileNo;
var EmailId;
var PhoneNo;
var str = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
for (var i = 0; i < str.length; i++) {
     document.getElementById("ctl00_PlaceHolderCenter1_txtboxContactperson").value = str[i].FirstName;
     document.getElementById("ctl00_PlaceHolderCenter1_txtboxMobileNo").value = str[i].MobileNo;
     document.getElementById("ctl00_PlaceHolderCenter1_txtboxEmailId").value = str[i].EmailId;
     document.getElementById("ctl00_PlaceHolderCenter1_txtboxTelephone").value = str[i].PhoneNo;

}



 }

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



 </script> 


Just remove charset=utf-8" from contentType: "application/json; charset=utf-8"

Should solve your problem. See: jQuery AJAX request failing in IE

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜