alienavatar
alienavatar

Reputation: 299

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

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.

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
    });

Upvotes: 0

Views: 807

Answers (1)

jAndy
jAndy

Reputation: 236202

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

Upvotes: 1

Related Questions