Check your php.ini file to make sure the option to use asp styled tags is enabled. Or, change the tags to the normal php tags. On 12/22/07, Larry Helms <larr_helms@xxxxxxxxx> wrote: > I'm trying to pickup/teach myself AJAX - which I'll eventually wrap with > PHP. I started > using this tutorial: http://www.w3schools.com/ajax/default.asp > > I'm on a MACINTOSH using MAMP (Mac equivalent to WAMP). I've also tried > this under > the installed http server (via ControlPanels -> Sharing -> Personal Web > Sharing). > > I have TWO files (named a little differently than the tutorial - but contain > the same thing; > essentially) - see below - (ajax.html & time.js) > > When I execute the code... in the Time: field... I only get '<%', instead of > the time. > The tutorial example (http://www.w3schools.com/ajax/ajax_serverscript.asp) > functions > correctly. > > Anybody got any ideas as to why the version running from my localhost > doesn't work??? > > Thanks, > Larr. > > --- ajax.html -- > <body> > <script type="text/javascript"> > function ajaxFunction() > { > var xmlHttp; > try > { > // Firefox, Opera 8.0+, Safari > xmlHttp=new XMLHttpRequest(); > } > catch (e) > { > // Internet Explorer > try > { > xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); > } > catch (e) > { > try > { > xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); > } > catch (e) > { > alert("Your browser does not support AJAX!"); > return false; > } > } > } > xmlHttp.onreadystatechange=function() > { > if(xmlHttp.readyState==4) > { > document.myForm.time.value=xmlHttp.responseText; > } > } > xmlHttp.open("GET","time.js",true); > xmlHttp.send(null); > } > </script> > <form name="myForm"> > Name: <input type="text" > onkeyup="ajaxFunction();" name="username" /> > Time: <input type="text" name="time" /> > </form> > </body> > </html> > > --- time.asp --- > <% > response.expires=-1 > response.write(time) > %> > > > -- Sent from Gmail for mobile | mobile.google.com