My jsonp code is not working using angular for some reason! I've read thousands of examples but it simply doesn't work. See my code below.
I've read this question and it hasn't resolved my problem Angularjs JSONP not working
My example code shows the http.jsonp call with the success and error methods defined. I'm using Chrome to develop and test it with for the moment and the second and third images show the ajax service call and the jsonp response from the service.
Latest update
After receiving help from @TheSharpieOne the server response is now returning an actual function (instead of a string which was the problem previously) but the success method is not executed for some reason?
$http.jsonp(url).then(function(response) {
alert('success'); // not hit
}, function onError(response) {
alert('error'); // this is displayed
});
Many thanks,
Angular JS
var url = serviceRoot + "api/customer/get?callback=JSON_CALLBACK";
$http.jsonp(url).success(function (data) {
alert('success'); // never called
})
.error(function () {
alert('error');
});
Chrome network panel
Shows chrome network panel, highlighting the ajax call
Ajax response