I'm trying to use AJAX to process information on my php page, but for some reason the first JS call doesn't seem to be executing. I've been looking at this off and on for 6 hours. Can anyone spot my mistake?
<script>
function GetData()
{
var idNumber=document.getElementById("idNumber").value;
var CallLetters=document.getElementById("CallLetters").value;
var AName=document.getElementById("AName").value;
var CName=document.getElementById("CName").value;
var Xcoord=document.getElementById("Xcoord").value;
var Ycoord=document.getElementById("Ycoord").value;
var Dispos=document.getElementById("Dispos").value;
var Comments=document.getElementById("Comments").value;
var Packaged="&id="+idNumber+"&Call="+CallLetters+"&AN="+AName+"&CN="+CName+"&X="+Xcoord+"&Y="+Ycoord+"&Di="+Dispos+"&Comm="+Comments;
alert(Packaged);
showK(Packaged,'../AJAX/ajax_lookup_group.php?editSave=1','ALists');
}
</script>
<script>
function showK(strSelect,strDestination,strDIV)
{
if (strSelect=="")
{
document.getElementById(strDIV).innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(strDIV).innerHTML=xmlhttp.responseText;
}
}
alert(strDestination+strSelect);
xmlhttp.open("GET",strDestination+strSelect,true);
xmlhttp.send();
}
</script>
<form>
<table><tr><td>
<input type="hidden" name="idNumber" id="idNumber" value="1">
<input type="text" name="CallLetters" id="CallLetters" size="2" value="TES"></td>
<td><input type="text" name="AName" id="AName" size="12" value="Testers"></td>
<td><input type="text" name="CName" id="CName" size="12" value="TesterBob"></td>
<td>X:<input type="text" name="Xcoord" id="Xcoord" size="2" value="333"><br>
Y:<input type="text" name="Ycoord" id="Ycoord" size="2" value="444"></td><td style="text-align:left"><select name="Dispos" id="Dispos">
<option value="1" selected="selected">1</option>
<option value="0">0</option>
<option value="2">2</option>
</select></td><td><textarea rows="2" cols="30" name="Comments" id="Comments">we are testing</textarea></td>
<td><input type="button" value="Save" onclick="GetData()"></td></tr>
</table>
</form>