I have a JSON object
{
"data": [{
"user_id":"1",
"user_name":"test",
"user_phone":"2147483647",
"user_email":"[email protected]"
}]
}
and a jQuery loop function
$.each(responseData, function(index, ProfileData) {
profiles.push(
application.getModel("Profile", [ ProfileData.user_id, ProfileData.user_name, ProfileData.user_phone, ProfileData.user_email ] )
);
});
But when the JSON object becomes this
{
"data": [{
"firm_id":"1",
"firm_name":"Firm",
"firm_phone":"2147483647",
"firm_email":"[email protected]"
}]
}
Then I want to check whether the JSON data has user or firm extensions, and also need to use this in the push() instead.
application.getModel( "Profile", [ ProfileData.user_id, ProfileData.user_name, ProfileData.user_phone, ProfileData.user_email ] )