AJAX: only error callback is been fired
First, checkout the real error you get (not certain you really get a 200 status ?)
error: function (err) { console.error("error"); console.log(err); console.log(err.stack); throw err;}
Show us the resulting log please.
As you have mentioned that you are making a curl
call to some other php
, what happens is whenever you make curl
call you have to return the response of the curl
to the client. So to transfer the return
value of curl
call, you have to set an option curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
.This will sort your problem. Hope so.
I did that a few weeks ago and for me it works if I call it like
$.ajax({ type: "POST", data: { action: "blah", mobileNo: that.mobNo, token: that.key }, url: "http://90.8.41.232/localhost/registry.php", cache: false, dataType: json,}).success (function (data, status, jqxhr){ // do your stuff}).error (function(x, status, jqxhr) { // handle your errors});