Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Assist request for onclick event to trigger ajax call?

Assist request for onclick event to trigger ajax call?

Assist request for onclick event to trigger ajax call?

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.

<input name="checkbox1" type="checkbox" id="checkbox1" onclick="Func1($field1,field2);" /><br />

function Func1(field1, field2) {
type: "POST",
url: "Alter-Checkbox.php",
data: { field1: field1, field2: field2 },
datatype: 'json',
cache: 'false',

test.php:61 Uncaught ReferenceError: Func1 is not defined
at HTMLInputElement.onclick (http://xx.xxxx.net/test.php:61:85)


RE: Assist request for onclick event to trigger ajax call?

I just copied your example and works fine. Maybe a typo?


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close