I'm trying to modify a simple html checkbox input item so when the user clicks the checkbox the logic calls a function which invokes an ajax call to a server program.
I've included a short snippet below:
Using alerts I've proven that the onClick event is triggered and (at one time) the javascript function was executing. But the $.ajax call to the server isn't happening.
At this point using the chrome browser and its inspection debugging function the console complains that the referenced function (Func1) is undefined.
Hopefully some guru(s) can provide some guidance so I can get this (supposedly) simple routine functional.
Thanks
<input name="checkbox1" type="checkbox" id="checkbox1" onclick="Func1($field1,field2);" /><br />
<script>
function Func1(field1, field2) {
$.ajax({
type: "POST",
url: "Alter-Checkbox.php",
data: { field1: field1, field2: field2 },
datatype: 'json',
cache: 'false',
});
}
</script>
test.php:61 Uncaught ReferenceError: Func1 is not defined
at HTMLInputElement.onclick (
I've included a short snippet below:
Using alerts I've proven that the onClick event is triggered and (at one time) the javascript function was executing. But the $.ajax call to the server isn't happening.
At this point using the chrome browser and its inspection debugging function the console complains that the referenced function (Func1) is undefined.
Hopefully some guru(s) can provide some guidance so I can get this (supposedly) simple routine functional.
Thanks
<input name="checkbox1" type="checkbox" id="checkbox1" onclick="Func1($field1,field2);" /><br />
<script>
function Func1(field1, field2) {
$.ajax({
type: "POST",
url: "Alter-Checkbox.php",
data: { field1: field1, field2: field2 },
datatype: 'json',
cache: 'false',
});
}
</script>
test.php:61 Uncaught ReferenceError: Func1 is not defined
at HTMLInputElement.onclick (