Ahmed Jalal Ahmed Jalal - 9 months ago 66
Ajax Question

JSONP ajax call executes error method its response is 200 ok

Here is my api calling its response is 200 OK but it not entered into the success method I have no clue where i am doing wrong. I enable CORS on server side.

$( document ).ready(function() {

url: 'https://localhost:44300/api/apim/{{Product.Id}}/'+email+'/',
dataType: 'jsonp',
success: function(data) {

$('#subscribe').prop('disabled', true);
$('#subscribe').text('Is Pending');

error: function(err)

type: 'GET'


enter image description here


You said dataType: 'jsonp', but the server said content-type: application/json.

JSONP is application/javascript because it isn't JSON (it's a hack to get around the same origin policy from before we had CORS, since you are using CORS, it is pointless … well, you claim you are using CORS, but I don't see an Access-Control-Allow-Origin header in the response).

Remove dataType: 'jsonp' and let jQuery work out the type of data from the content-type response header.