<?php
echo '<input name="checkbox" value="student" type="checkbox" onclick=change(this, "type"); />';
?>
This isn't working. I keep getting in my console:
Uncaught SyntaxError: Unexpected token }
How do I input a string as a parameter for an onclick event?
<script>
function change(cb, year) {
var value = cb.value;
var type = cb.checked;
var yr = year;
$.ajax( {
type: 'POST',
url:"process.php",
data: { 'data':value, 'type':type, 'yr':yr, },
success:function(result) {
console.log("works" + result);
}
});
}
</script>