Jump to content

AJAX help!


clonetrooper9494

Recommended Posts

I copied it right from the AJAX page, and it just doesn't work... :) what am I doing wrong?http://clone-drone.net/axaj_test.html

<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","http://clone-drone.net/time.php",true);//my host doesn't support ASP... so I used PHP  xmlHttp.send(null);  }</script><form name="myForm">Name: <input type="text"onkeyup="ajaxFunction();" name="username" />Time: <input type="text" name="time" /></form></body></html>

http://clone-drone.net/time.php

<?phpecho "testing";return "123";?>

ASP doesn't work with my host... so I used PHP... what am I doing wrong?

Link to comment
Share on other sites

It's working OK in my browsers.Your "return 123;" line isn't necessary. AJAX receives any text that you would see by opening the PHP file directly.Just use echo to display the information you want.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...