开发者

Data is null when I retrieve from ajax call but working in IE

开发者 https://www.devze.com 2023-01-19 18:38 出处:网络
I am using jquery ajax method to retrieve data. It is working in IE but I am getting data as null in FF and Google chrome.

I am using jquery ajax method to retrieve data. It is working in IE but I am getting data as null in FF and Google chrome. I think the problem is, mozilla cant get 'data', because alert(data) returns null; even when I debug in firebug it is showing data is null.

开发者_JS百科

My code is:

$.ajax({
        type: "POST",
        url: "http://myserver.com/idpwd.asmx/idpwd",
        data: "{ 'userID': '" + $("#usrid").val() + "','password': '" + $("#password").val() + "' }",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: Success,
        error: Error
    });


Two things I notice here:

  • Your JSON string is not valid. Key/Value pairs need to have double quotes
  • The hostname is probably not the same you're executing your ecma-/javascript
0

精彩评论

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