const spark = { invoicesPendingPayment: function(){ $.ajax({ type: "GET", dataType: 'json', processData: false, contentType: 'application/json', CrossDomain: true, async: false, url: localStorage.dataurl+'antiguedad-pagos-empresa/', error: function (xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response alert(xhr.status + ' pelas'); alert(xhr.responseText); } }).done(function (response) { console.log(response) }) } }