so I am very new to ajax and i will confess that I am not the most brilliant javascript programmer in the world, but I am trying to learn.
i know some php, so I figured I would use xajax for the ajax stuff, which seems to be a lot less coding than using stuff like rico and whatnot.
anyways, i am trying a small example, and the example is basically to be able to display the current system date as a link, and whenever you click the link, the link automatically updates to the new system time without reloading the entire page.
here is what i have tried:
[CODE]
<HTML>
<HEAD>
<?php
require_once(‘./xajax/xajax.inc.php’);
function updateDate()
{
$output = shell_exec(‘date’);
$objResponse = new xajaxResponse();
$objResponse->addAssign(“date_link”, “innerHTML”, $output);
return $objResponse;
}
function processView()
{
$output = shell_exec(‘date’);
$a = “<a href=”#” onclick=”xajax_updateDate();” id=”date_link” name=”date_link” title=”Check the time”>$output</a>”;
return $a;
}
$xajax = new xajax();
$xajax->registerFunction(“updateDate”);
$xajax->processRequests();
$xajax->printJavascript(‘./xajax/’);
?>
</HEAD>
<BODY>
<?php echo processView(); ?>
</BODY>
</HTML>
the error I am receiving is:
[CODE]
Error: the XML response that was returned from the server is invalid.
Received:
<HTML>
<HEAD>
<?xml version=”1.0″ encoding=”utf-8″?><xjx><cmd n=”as” f=”date_link” p=”innerHTML”>
<![CDATA[Fri Dec 29 09:04:58 CST 2006]]></cmd></xjx>
does anyone know what I am doing wrong. I have examples of what to do if I am using some sort of button, but I have yet to find anything that shows how to update a link. what do you put in the href attribute? the onclick?
thanks for any help. im sure it is something trivial and stupid.