02-23-2008, 10:02 PM
|
#4 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
|
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>
|
|
|
|