user1927666
user1927666

Reputation: 1

jQuery jsonp not firing the success handler even with the valid json format

$.ajax({
     url: url,
     dataType: 'jsonp',
     success: function(data) { //not firing at all
       console.log('success');
       console.log(data);
     }
     error: function() {  //always firing even with status 200 & valid JSON response.
    console.log('error');
     }             
});

Upvotes: 0

Views: 166

Answers (1)

Sumeet Patil
Sumeet Patil

Reputation: 432

$.ajax({
     url: url,
     dataType: 'jsonp',
     success: function(data) { //not firing at all
       console.log('success');
       console.log(data);
     },                         //You have missed a comma here..
     error: function() {  //always firing even with status 200 & valid JSON response.
    console.log('error');
     }             
});
  • You have missed a comma.
  • Just check the comment

Upvotes: 1

Related Questions