I am trying to make a cross-domain request using jQuery/AJAX. I have the following code;
$.ajax({
url: "http://www.cjihrig.com/development/jsonp/jsonp.php?callback=jsonpCallback&message=Hello",
crossDomain:true
})
.done(function( msg ) {
alert( "Done : " + msg );
})
.fail(function( msg) {
alert( "Fail : " + msg);
})
.always(function( msg ) {
alert( "Always : " + msg );
});
The URL http://www.cjihrig.com/development/jsonp/jsonp.php?callback=jsonpCallback&message=Hello returns JSON object when calling directly and works fine when using JSONP in traditional manner (i.e. through dynamic script tag injection)
But why do I get an error when using it with jQuery/AJAX ?