I'm trying to access a cross domain .js file using ajax:
$.ajax({
type:'get',
crossDomain:true,
url: "http://localhost/62588/scripts/bootStrapper.js",
contentType: "application/json",
dataType: 'jsonp'
}).done(callback);
I have a callback at the moment:
getBootStrapperScript(function (callback) {
//do somethibg
})
I get the following error:
XMLHttpRequest cannot load http://localhost/62588/scripts/bootStrapper.js. Origin http://localhost:62607 is not allowed by Access-Control-Allow-Origin.
I have been reading about JSONP but I'm not sure how to use it to load a .js file from anoather domain.
If I change the above code to use 'jsonp' for the datatype but I then get this errer:
GET http://localhost/62588/scripts/bootStrapper.js?callback=jQuery18206067646441515535_1354459693160&_=1354459696966 404 (Not Found)
How can I load cross domain js files?