Thread: AJAX Help
View Single Post
Old 02-23-2008, 10:02 PM   #4 (permalink)
CoryMathews
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

thanks for the help so far guys. When i changed it to byId it works. Now i gotta add one last feature. That is to pick which id to update by passing in a var (idKey). Problem is the variable i pass in is always undefined where i alert it. Heres the new javascript.

Code:
<script type="text/javascript">
function ajaxFunction(IdKey){
var xmlHttp;
try  {
  xmlHttp=new XMLHttpRequest();
  } catch (e)  {
  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(IdKey) {
    if(xmlHttp.readyState==4) {
		alert(IdKey)
      document.getElementById('IdKey').innerHTML=xmlHttp.responseText;
      }
    }
  xmlHttp.open("GET","test.php",true);
  xmlHttp.send(null);
  }
</script>
CoryMathews is offline  
Reply With Quote