I've a jquery post function that returns a data object from a php code block.
$.post("get_chat_history.php", {
item_id : item_id,
participant_1 : participant_1,
participant_2 : participant_2
}, function(data) {
alert(data);
return data;
});
this is called from the following function in another javascript file
var data = getChatHistory(current_member_id,item_global["user"] ["member_id"],item_global["id"]);
alert(data);
now inside the $.post the alert(data) throws out the correct values in json format, but when I test the same value returned to the calling function I get undefined.
Is there something I'm missing as I want to keep this function generic and callable from elsewhere??
Regards,
Sapatos
$.postcould return that value directly and you would not need a callback.