JQuery Post And Get
<p>I have a method I'm trying to write that can post data to a php file and get the results and return the output in a variable. For some reason, my block of code is not working. </p>

<pre><code>function post_get(){

var result = null;

$.post("modules/data.php", { "func": "getNameAndTime" },
function(data){
    result = JSON.parse(data);
}, "json");


return result;
}
</code></pre>

<p>I get this error when using this method</p>

<p>SyntaxError: JSON Parse error: Unexpected identifier "undefined"</p>
