tags:

views:

31

answers:

1

Hi 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 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
        });
+1  A: 

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
jAndy
Thank you jAndy. Where should I double quote in the code? The web service that i am calling and the page is hosted that I am testing are in the same domain. But I am testing from general client machine. But why it is working in IE if there is cross domain issue?
alienavatar