Here’s a standard AJAX onreadystatechange function to populate a DIV with some code:
if (objXmlHttp.readyState==4 || objXmlHttp.readyState=="complete")
header('Content-Type: text/xml'); command beforing returning the XML).
<HTML>some html goes in here</HTML>
if (objXmlHttp.readyState==4 || objXmlHttp.readyState=='complete')
if (XMLValueExists(objXmlHttp.responseXML, 'HTML'))
SetValueFromXML(objXmlHttp.responseXML, divID, 'HTML');
if (XMLValueExists(objXmlHttp.responseXML, 'JS'))
(I use a couple of support functions to parse the XML. They involve calling
objXmlHttp.getElementsByTagName and some other DOM-wrangling code)
Note that some people frown on using
eval() statement comes from your website. And if you’re going to argue with me by spouting off stuff about “spoofing”, then you’ve probably got more important things to worry about from a security standpoint.