Unexpected Identifier Error

metalgearsolid

New Member
I'm not sure why my code won't run.Here is my JavaScript code:\[code\]fuction update(id, value){ xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4 && xmlhttp.status == 200){ document.getElementById("response").innerHTML=xmlhttp.responseText; }else{ document.getElementById("response").innerHTML= "AJAX Failed: " + xmlhttp.status; } } xmlhttp.open("GET","updatevis.php?id="+id+"&value="http://stackoverflow.com/questions/13726834/+value); document.getElementById("response").innerHTML="Sending Ajax Request"; xmlhttp.send();}\[/code\]This is my HTML form code:\[code\]<input type="checkbox" name="visible" id="'.$id.'" checked="'.$checked.'" onchange="update('.$id.', '.$visible.')" />\[/code\]The \[code\]id\[/code\] would be anything from 1-whatever its auto increment, visible is a \[code\]int\[/code\], either 1 or 0 Checked is just my code to have it start checked or notI have already run this code through chrome and Firefox, chrome gave my two errors a Unexpected identifier on line 5 (the line where I define the function) and a \[code\]ReferenceError\[/code\] saying the function is not defined, on line 30 (the checkbox one)
 
Back
Top