can we call ajax inside ajax success
$.ajax({ type: "post", url: "ajax/example.php", data: 'page=' + btn_page, success: function (data) { var a = data; // This line shows error. $.ajax({ type: "post", url: "example.php", data: 'page=' + a, success: function (data) { } }); } });
Source: stackoverflow.com
jquery ajax success function not executing
For many times I have encountered similar problems and most of the time the reason was a malformed json. Try getting the result as text data type to see whether this is your problem. Also, I'd like to ask if you're using a parameter like "&jsoncallback=?" in your url, since your data type is jsonp instead of simple json.
Source: stackoverflow.com