I'm calling this function from my asp.net form and getting following error on firebug console while calling ajax.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://anotherdomain/test.json. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
var url= 'http://anotherdomain/test.json'; $.ajax({ url: url, crossOrigin: true, type: 'GET', xhrFields: { withCredentials: true }, accept: 'application/json' }).done(function (data) { alert(data); }).fail(function (xhr, textStatus, error) { var title, message; switch (xhr.status) { case 403: title = xhr.responseJSON.errorSummary; message = 'Please login to your server before running the test.'; break; default: title = 'Invalid URL or Cross-Origin Request Blocked'; message = 'You must explictly add this site (' + window.location.origin + ') to the list of allowed websites in your server.'; break; } });
I've done alternate way but still unable to find the solution.
Note: I've no server rights to make server side(API/URL) changes.