I am trying to detect first index name from my JSON object and this data come from API ..
if success data will return something like this :
var setRecharge = [{"data":{"transaction_id":"502014","tr_time":"2013-06-18 15:34:46","tr_channel":"WEB","opening_balance_a":"1000.00","closing_balance_a":"990.00"}}];
and if failed it will return :
var setRecharge = [{"error":{"code":"AccountA","message":"Problem with A account: Password is not correct"}}];
so from here i need to know the first index is data
or error
so i can continue wil if else statement ..
i try to refer this topic Javascript: Getting the first index of an object but not sure why it's not working and my data also has bracket and block.