execute a function if the api ajax call was successfull
Execute a function that is passed as an argument if the ajax jquery request was successful
JavaScript
$(function(){
function doAjaxRequest(callback) {
$.ajax({
type: "POST",
url: "http://ip.jsontest.com/",
dataType: "json",
success: function (data) {
callback;
} //success
});
}
function printConsole() {
object = { hola: 'hola', otro: 'otro' }
console.log(object);
}
doAjaxRequest(printConsole());
})