POST request is returning response success but is not posting the data
Posted
by
Vineeth
on Stack Overflow
See other posts from Stack Overflow
or by Vineeth
Published on 2014-06-10T09:13:32Z
Indexed on
2014/06/10
9:24 UTC
Read the original article
Hit count: 159
I am making a POST request to the MOXTRA API and it should return me the following response :
{
"data":
{
"id": user_id, //some user id
"revision": 5,
"name": "My First Binder",
"created_time": 1402384947587,
"updated_time": 1402384947587
},
"code": "RESPONSE_SUCCESS"
}
And I am making this POST request using Java Script
var d =
{
'name': 'My First Binder'
};
var bind = JSON.stringify(d);
$.post('https://api.moxtra.com/user_id/binders?access_token=' + access_token+ '&callback=?', bind, function(response) {
alert( response.data.id);
},'json');
})
But the alert that i get for alert(response.data.id) is "undefined" and the alert if i write alert(response.code) is "RESPONSE_SUCCESS"
What is wrong with the above code , how am i getting a response success and getting undefined at the same time
© Stack Overflow or respective owner