Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7192655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:59:09+00:00 2026-05-28T19:59:09+00:00

I am trying to click an input type checkbox.. when clicked an AJAX call

  • 0

I am trying to click an input type checkbox.. when clicked an AJAX call is performed. I have a listener set up but nothing fires … firebug also shows nothing.

Code:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js{API removed}"></script>
    <script type="text/javascript">
    $(document).ready(function() {
alert('test');
if ($('#profile_visible:checked').val() !== null) {

        $.ajax({
          url: 'inc/profileVisible.php',
          success: function(data) {
            $('#resultProfileVisible').innerhtml="success";
            alert('Load was performed.');
          }
        });
}
    }
    </script>

…and in the body of the document:

    <form method="post" action="profile/<?php echo $_SESSION['usern']; ?>/settings">
    <p><input type="checkbox" id="profile_visible" name="profile_visible" /> Show Profile<span id="resultProfileVisible"></span></p>
    </form>     

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:59:11+00:00Added an answer on May 28, 2026 at 7:59 pm

    You don’t have an event listener set up. Bind event handlers with on (jQuery > 1.7) or bind (jQuery < 1.7) or jQuery’s various shortcut methods (like .change or .click):

    $(document).ready(function() {
        $("#profile_visible").change(function() {
            if (this.checked) {
                $.ajax({
                    url: 'inc/profileVisible.php',
                    success: function(data) {
                        $('#resultProfileVisible').html("success");
                        alert('Load was performed.');
                    }
                });
            }
        });
    });
    

    Also, use .html() instead of .innerHtml to set an element’s html contents when using a jQuery object.

    Example: http://jsfiddle.net/andrewwhitaker/8x6h8/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some checkbox inputs like so: <input type=checkbox name=1 class=filter/> <input type=checkbox name=2
I'm trying the following: $(#button_feedback).click(function () { $.ajax({ type: POST, contentType: application/json; charset=utf-8, url:
I am trying to clear only specific ID input field on my checkbox click.
Hi I have the following page: <input type=checkbox name=fruit1 id=1 class=box>Banana<br /><br /> <input
I'm trying to submit a form with AJAX through jQuery: $('.submit input').click(function() {return false;});
I have this JQuery code: jQuery(#form).click(function() { $(input[name='copyno']:checked).each(function() { checkboxData = copyno=+$(this).val(); id=$(this).val(); jQuery.ajax({
I have the following code structure: <input type=checkbox name=some_name_1 value=some_val /> <input type=text name=input_name_1
I have an html like below HTML: <INPUT TYPE=CHECKBOX NAME=clcik onClick=add('1234','blah') /> <input type=hidden
I have something like this: <table> <tr><td><input type=checkbox id=checkbox1></input></td><td><input type=text disabled=disabled id=textInput1></input></td></tr> <tr><td><input type=checkbox
i have 3 forms and a checkbox like this: <input type=checkbox name=confirm_agreement value=yes <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.