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 1051473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:56:17+00:00 2026-05-16T16:56:17+00:00

I am looking at the console in firebug when I click on a function

  • 0

I am looking at the console in firebug when I click on a function which performs an ajax request. The problem is, that one click of a button should send 1 ajax request, but I get 2 requests being sent!

The code for my js looks like this:

$(document).ready(function() {
   $('.book_now').click(function(){


$.ajax({
  type: 'POST',
  url: '/booking.php',
  data: 'event_id='+event_id+'&time_id='+time_id,
  success: function(data) {
    console.log('inside');
    $('#booking_box_content').html(data);
  }
});


  });
});

Which seems pretty straight forward right?

In my console however, I see 2 x GET requests off 1 click.

My button is simply:

<div class="book_now"></div>

Am I missing something – is there supposed to be 2 GET requests?

Is it by any chance loading up the $(document).ready() function again when the new file is loaded and therefor executing the click function again?

Note: I’m not double clicking the button. It probably doesn’t matter, but if I change it to POST it does it twice also.

Edit: the response from booking.php

<div id="booking_box_left">
  <h1 class="speaker_name"></h1>
  <h1 class="event_name"></h1>

  <div class="event_start_header">Start</div><div id="event_start_datetime">, </div>
  <div class="cleared"></div>
  <div class="event_end_header">End</div><div id="event_end_datetime">, </div>
  <div class="cleared"></div>
  <div class="event_where_header">Where</div><div id="event_where"><strong></strong><br /><br />
</div>

</div>
<div id="booking_box_right_container">
  <form id="booking_form_1" method="post">
    <input type="hidden" name="booking_id" value="7a614fd06c325499f1680b9896beedeb" />
    <input type="hidden" name="event_id" value="" />
    <input type="hidden" name="time_id" value="" />
    <div id="booking_box_right">
      <h1>To reserve your seat</h1>
      <input type="text" name="booking_email" class="enterSomething booking_email" title="Enter your email..." />
      <div class="booking_email_helper">On clicking next a ticket will be held for you for a short period for you to complete your registration.</div>
      <input type="submit" id="next" value="Next" />
    </div>
  </form>
</div>

Note: nothing in this response has any functions being triggered to my knowledge. I’m skeptical that the response is what is firing off the ajax request twice… if the click function is only running once, then it can’t possibly be the button is executing the function twice, but the $.ajax() part, namely the success callback which is. I’ve updated the JS code to show how I structured the console.log() stuff.

FINAL EDIT:

My ajax function was wrapped inside of the following:

   $('#shade, #booking_box').fadeIn(function(){

     // ajax function

  }

I had no idea but it was calling this function for for when the #shade (my thickbox) and the #booking_box came in hence running it TWICE! 🙁

I feel like such a tool.

Thanks everybody for your help.

  • 1 1 Answer
  • 1 View
  • 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-16T16:56:18+00:00Added an answer on May 16, 2026 at 4:56 pm

    I had my function inside 2 divs with the following JS

    $('#shade, #booking_box').fadeIn(function(){
    
     // ajax function
    
    }
    

    I didn’t realise that by doing this it would execute inside the function 2 times for each div I was fading in…

    Solution was:

    $('#shade').fadeIn(function(){
    
         $('#booking_box').fadeIn(function() {
    
            // ajax function
    
         });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a plugin that would run in a console continuously to scan
Looking for a control that allows to select one text value at a time
I was thinking to implement fetching of data with ajax request on click of
I'm looking for the way to log stuff in Internet Explorer Developer Console that
I am looking to figure out what my IP address is from a console
Looking for a perl one-liner what will find all words with the next pattern:
One thing I really love about languages such as Python is that if you
I've been looking for a solution to use Javascript to open or activate Firebug.
Im looking to send command strings to a flash app, to execute debug commands.
I'm looking for a tool that will give me the proper generated source including

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.