When I give my local path in Jquery it is working.Eg. url: "/LP18WS.asmx/AuthonticateUser", But when I change it to online path Eg. url: "http://lp18mobile.azurewebsites.net/LP18WS.asmx/AuthonticateUser" What I need to do to make it working. Is ther anything we need to do with namespace because if you open web service http://lp18mobile.azurewebsites.net/LP18WS.asmx at the bottom, you can see some message about namespace of webservice.
Asked
Active
Viewed 121 times
1 Answers
0
you need to Set crossDomain Property to true to make a Cross domain call.
jQuery.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data:'',
crossDomain :true,
url: 'http://lp18mobile.azurewebsites.net/LP18WS.asmx/AuthonticateUser',
success: function (result) {
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Error in Save Data: " + textStatus);
}
});
Please See below Link For more Information:
http://api.jquery.com/jQuery.ajax/

Mahesh Chitroda
- 178
- 2
- 10
-
`crossDomain :true` is good for a very limited set of circumstances and most probably not in this case, with `dataType: 'json'`. – Beetroot-Beetroot Apr 29 '13 at 10:32
-
for this you use JsonP datatype. – Mahesh Chitroda Apr 29 '13 at 10:51
-
Possibly, though there's more to do than just changing `dataType: 'json'` to `dataType: 'jsonp'`. – Beetroot-Beetroot Apr 29 '13 at 10:55
-
Thanks, we did that but still not working $.ajax({ crossDomain: true, url: "http://lp18mobile.azurewebsites.net/LP18WS.asmx/AuthonticateUser", //url: "/LP18WS.asmx/AuthonticateUser", contentType: "application/json; charset=utf-8", data: {}, dataType: "jsonp", success: function (msg) { if (msg.d == "Success") { } }, }); } – anuj Apr 29 '13 at 12:20
-
please check that crossDomainScriptAccessEnabled="true" is define in webservice project config or not – Mahesh Chitroda Apr 29 '13 at 12:25
-
More info Please check link. http://stackoverflow.com/questions/14586328/consuming-a-wcf-service-in-jquery-via-ajax-call-in-a-different-project-cross-do – Mahesh Chitroda Apr 29 '13 at 12:26
-
yes crossDomainScriptAccessEnabled="true" in web.config.