return object from function is undefined from $.post in jquery
<p>I've a jquery post function that returns a data object from a php code block.</p>

<pre><code>$.post("get_chat_history.php", {
    item_id : item_id,
    participant_1 : participant_1,
    participant_2 : participant_2
}, function(data) {
    alert(data);

    return data;

});
</code></pre>

<p>this is called from the following function in another javascript file</p>

<pre><code>var data = getChatHistory(current_member_id,item_global["user"]    ["member_id"],item_global["id"]);
alert(data);
</code></pre>

<p>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.</p>

<p>Is there something I'm missing as I want to keep this function generic and callable from elsewhere??</p>

<p>Regards,</p>

<p>Sapatos</p>
