Can't get responseText from $.post
I need to get a string from the server using jquery $.post, the issue is
that I can't get the responseText from it. So if I run
role = $.post('user_helper/return_current_role', {id: 3}, null,
"json").responseText;
console.log(role);
I get undefined If I try
role = $.post('user_helper/return_current_role', {id: 3}, null, "json");
console.log(role);
I get an object Object { readyState=1, getResponseHeader=function(),
getAllResponseHeaders=function(), more...}, where responceText is, for
example, teacher. Here is this response, copied from firebug:
readyState
4
responseText
"teacher"
status
200
statusText
"OK "
No comments:
Post a Comment