I have a problem with my AJAX script, I put in some alerts to see where the problem lies, here is my script:
<script language="javascript" type="text/javascript"> function positionUpdate(var1, var2){ alert ("1"); var queryString = "?var1=" + var1 + "&var2=" + var2; alert ("2"); ajaxRequest.open("GET", "position_update.php" + queryString, true); alert ("3"); ajaxRequest.send(null); alert ("4"); } </script>
Alert 3 doesn’t show up when I run it so it looks like the problem is with this line but I don’t know what it is:
ajaxRequest.open("GET", "position_update.php" + queryString, true);
Thanks, Stanni
You haven’t instantiated the ajaxRequest object yet. At that point, it’s still undefined.
You’ll need to have this first: