I keep getting the above error for some reason. I've tried commenting out all of my other javascript, and it fixed nothing. Here's my code:
function violation_change(){
var vio = document.getElementById('violation').value;
if(vio==''){
document.getElementById('violation_report').innerHTML='This person has no current violations.';
return;
}
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("violation_report").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","includes/addCall.php?violation="+vio+"&pro=<?php echo $_GET['pro']; ?>",true);
xmlhttp.send();
}
EDIT: $_GET['pro'] is just a number. Forgot to mention it, sorry.
Try using urlencode()
around the $_GET['pro'];
:
xmlhttp.open("GET","includes/addCall.php?violation="+vio+"&pro=<?php echo urlencode($_GET['pro']); ?>",true);
EDIT: Okay this will not do it still. You need to addslashes to all the speechmarks too:
xmlhttp.open("GET","includes/addCall.php?violation="+vio+"&pro=<?php echo addslashes(urlencode($_GET['pro'])); ?>",true);