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
精彩评论