How can I access my PHP variables when calling ajax in jQuery?
<p>I am attempting to create a simple comment reply to posts on a forum using the AJAX function in jQuery. The code is as follows:</p>

<pre><code>$.ajax({type:"POST", url:"./pages/submit.php", data:"comment="+ textarea +"&amp; thread="+ currentId, cache:false, timeout:10000,
        success: function(msg) {
                // Request has been successfully submitted
                alert("Success " + msg);
        },
        error: function(msg) {
                // An error occurred, do something about it
                alert("Failed " + msg);
        },
        complete: function() {
                // We're all done so do any cleaning up - turn off spinner animation etc.
                // alert("Complete");
        }
    });
</code></pre>

<p>Inside the submit.php file I have this simple if->then:</p>

<pre><code>    if(System::$LoggedIn == true)
{
    echo "Yes";
} else {
    echo "No";
}
</code></pre>

<p>This call works on all other pages I use on the site, but I cannot access any of my variables via the AJAX function. I've tested everything more than once and I can echo back whatever, but anytime I try to access my other PHP variables or functions I just get this error:</p>

<blockquote>
  <p>Failed [object XMLHttpRequest]</p>
</blockquote>

<p>Why am I unable to access my other functions/variables? I must submit the data sent into a database inside submit.php using my already made $mySQL variable, for example. Again these functions/variables can be accessed anywhere else except when I call it using this AJAX function. After hours of Googling I'm just spent. Can anyone shed some light on this for me? Many thanks.</p>
