2
Reply

How to call WebMethod from cross domain

Ajay Saini

Ajay Saini

Jun 17 2015 5:58 AM
680
I want to call a WebMethod in my application hosted on different server and url, but fails every time.
My code is :
 
$.ajax({
url: 'http://xyz.com/ATAServices/ServicePage.asmx?CallWebServiceUsingJson',
type: "GET",
crossDomain: true,
async: false,
data: JSON.stringify({ UserName: $('#txtUserName').val(), UserPassword: $('#txtUserPasssword').val(), SiteName: '1' }),
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function (data) {
 },
 error: function (ts) {
 alert(ts.responseText)
 }
 });
 
Please help me to use Cross Domain webmethod 
 

Answers (2)