I have a cordova app and I am making ajax calls to the server and I want to see the response. There is fail
which gets called and it returns me response error and I want to properly evaluate that error response. For that, I created a div
and populates the error responses into that but all I get on my mobile screen is this: [Object object]
. I want to expand this object
to see everything since I don't know what is residing in this object.
This is my ajax call:
function getUserDefaultWalletUpdatedBalance()
{
$.ajax(
{
url: request_url('get-default-wallet-balance'),
type: "get",
data:
{
'user_id': window.localStorage.getItem('user_id'),
},
dataType: 'json',
beforeSend: function(xhr)
{
xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET');
xhr.setRequestHeader('Authorization-Token', `${window.localStorage.getItem('token')}`);
$('.loader').css('display', 'block'); //show loader
},
})
.done(function(data)
{
$('.loader').css('display', 'none'); //hide loader
$('.profileDiv').css('display', 'block'); //show page
if (data.success.status == 200)
{
// console.log(data.success);
$(".av_blance").text(data.success.defaultWalletBalance);
}
})
.fail(function(error)
{
$('.loader').css('display', 'none'); //hide loader
$('.my').text(error);
});
}