I was consuming some 3rd party web api and when i call that web api through ajax call in my application, always goes to error instead of success. While checking in console i got "XMLHTTPRequest cannot load http://... Origin http//localhost:port/ is not allowed by Access-Control-Allow-Origin" error
$.ajax({
url: "SomeURL",
type:"GET",
dataType: 'jsonp',
crossDomain: true,
success: function (data) {
alert("Success");
},
error: function (data, Errtext) {
alert("some error occured");
}
});
When i access that URL directly in browser i receive data in XML format
I also refered similar issue How to resolve uncaught syntax error in jsonp but not get the solution
Thanks in advance