Ajay Saini

Ajay Saini

  • 1.5k
  • 183
  • 24k

How to call WebMethod from cross domain

Jun 17 2015 5:58 AM
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)