Ok guys so I am hopelessly new to Javascript. I have been doing good so far. But I can't seem to figure out what the issue is here. I am trying to send some data to a php file via GET to change some data on the database when you check the checkbox. Here's the code.
<?
$comple = $tasking['status'];
if($comple=="complete"){
?>
<input type="checkbox" name="<? echo $tasking['id']; ?>" checked="true"
onchange="change()"> <? echo $tasking['detail']; ?><br>
<?
}
else{
?>
<input type="checkbox" name="<? echo $tasking['id']; ?>" onchange="change()"> <? echo
$tasking['detail']; ?><br>
<?
}
?>
<script>
function change(){
var id = document.getElementById(this).name;
var ch = document.getElementById(this).checked;
var sendto = 'changetask.php?id=' + id + '&&ch=' + ch;
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET",sendto,false);
xmlhttp.send(null);
}
else{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET",sendto,false);
xmlhttp.send();
}
}
</script>