Topic: new on Xajax

I have differents tutorial some referenced to 0.2 and the one here referenced to 0.5 but none had work on my page. I need some help, I have a form to insert new employees on a database, I need to validate if current emp code is alreade on database, so I did following function

$objAjax = new xajax();

function checkEmpCod($cod)
    include('includes/conecta.php');    //connect to database
    $query = "SELECT codemp from empleados WHERE codemp = '$cod'";
    $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error());
    if (mysql_num_rows($result) == 1)
        $strerror="Empleado Ya Existe";
    { $strerror="";       
    $objResponse = new xajaxResponse();
    $objResponse->assign("chkcod", "innerHTML", $strerror);
    return $objResponse;

here is my html call

<td><input type="text" name="codemp" id="codemp" style="empleado"  onchange="$objAjax_checkEmpCod()" /></td>
<td><p id="chkcod"></p></td>

any idea what is my problem? please help me.

Re: new on Xajax

Yes it is necromancy...
But the solution can be cleared easily:





Remember "printJavascript()" is a $objAjax's function.

Then, always try to put this function at the body's end of your Html code.
Like that:


or between <head></head>, but prefer the first solution


Your call is false too:

<td><input type="text" name="codemp" id="codemp" style="empleado"  onchange="$objAjax_checkEmpCod()" /></td>

Try this:

<input type="text" name="codemp" id="codemp" style="empleado"  onchange="xajax_checkEmpCod();" />