Pls. help. I am breaking my head

Pls. help. I am breaking my head

Hi,
I have a form that uses a jquery tab. I am posting data to php using the following,
                 var jqxhr =  $.post(
                        "cgi-bin/docallrecord.php",
                        { id: "1",
                          tablename: tablename,
                          startdate: stdate,
                          enddate: enddate,
                          phonetype: phonetype,
                          phonenumber: phonenumber,
                          uploadedfile: upfname,
                          outformat: outformat
                        },
                        function(data) {
                                alert(data);
                        }
                ).done(function(){alert("success"); })
                .fail(function(){alert("fail"); })
                .always(function(){alert("complete successfully"); });
















I donot see the return code from php. The php is receiveing data and sending result back to jquery.
Pls, help me how to debug this,
Here is my php code,
<?php
$usrname=$_SERVER['PHP_AUTH_USER'];
$status=system("/usr/bin/perl authdd.pl tst",$retval);
if($retval == 1)
{
        error_log("Access Denied",3,"/export/home/dpub/php.log");
        echo "Access Denied.Please contact the Administrator";
        exit();
}
else
{








        echo "success";    
        error_log("Access Allowed",3,"/export/home/dpub/php.log");
}
>


 
Could anyone pinpoint what I am doing wrong?
 
Thanks.