Return from Jquery $.ajax
<p>I have the following extremely basic $.ajax function:</p>

<pre><code>function doAjax(url, args){
    var retVal = $.ajax({  
                    type:   "GET",
                    url:    url,
                    data:   args,
                    async:  false
                 }).responseText;
    return retVal;
}
</code></pre>

<p>When processed, the returned data from the url should be some text, like "Invalid User credentials".</p>

<p>What is actually being returned by retVal some preformatted HTML, specifically:</p>

<pre><code>&lt;html&gt;
   &lt;body&gt;
       &lt;h1&gt;SRV Server:&lt;/h1&gt;&lt;br&gt; Document Contains no data. 
   &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I am not understanding why. Can anyone explain what is going on with this script?</p>

<p>The server side code is accepting and processing the data correctly. This is the code that the $.ajax calls, it validates the args and processes the data accordingly.</p>

<p>The return from the '$retval = $fvAPI->responseCurl['ERROR'];' statement is: "Invalid User credentials".</p>

<pre><code>include_once $_SERVER['DOCUMENT_ROOT'].'/inc/freightView.inc.php';
$id     = 0;
$fv     = 0;
$status = 0;
$retval = null;
if(isset($_GET['id'])){
     $id=$_GET['id'];
    if(is_numeric($id)){
        if(isset($_GET['fv']) &amp;&amp; strlen($_GET['fv'])&gt;3){
            $fv1 = substr($_GET['fv'],4,1);
            if(is_numeric($fv1)&amp;&amp; $fv1&gt;0){
                $fv=$fv1;
                $status=1;
            }
            else $status = 0;
        }
        else $status = 0;
    }
    else $status = 0;
}
else $status = 0;
if($status==1){
    $fvAPI = new fv($id);
    switch ($fv){
        case 1:
            if($fvAPI-&gt;postEditXML()){
                $retval = $fvAPI-&gt;responseCurl['ERROR'];
            }

            break;
        case 2:
            break;
        case 3: 
            break;
        case 4:
            break;
        defaut:
            break;
    }
}
return $retval;
</code></pre>
