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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:58:36+00:00 2026-05-27T14:58:36+00:00

I have a form in a lightbox to add new entry to my datatable

  • 0

I have a form in a lightbox to add new entry to my datatable the form in the box work with this code :

$("#add-quotation").click(function(event) {
event.preventDefault(); 
var customer_id = $(this).attr('data-customer');    
$.nmManual(
    '#quotation_manage',{
        sizes: {    // Size information
        w: 500, // Initial width
        h: 500  // Initial height
    }
    });
    $('#quotation_submit').live('click', function(event){
    event.preventDefault();
    if(typeof($.nmTop()) != "undefined"){
        $.nmTop().close();
    }   
    var loading = $('.loading-notification');
    loading.removeClass('hidden');
    var date = $('#date_activate').val();
    var budget = $('#budget').val();
    var hospital = [$('#hospital').val(), $('#hospital option:selected').text()];
    var dental = [$('#hospital').val(), $('#hospital option:selected').text()];
    var optical = [$('#optical').val(), $('#optical option:selected').text()];
    var doctor = [$('#doctor').val(), $('#doctor option:selected').text()];
    $.ajax({
                type: 'POST',
                data: 'create=true&customer_id=' + customer_id + '&date=' + date + '&budget=' + budget + '&hospital=' + hospital[0] + '&dental=' + dental[0] + '&optical=' + optical[0] + '&doctor=' + doctor[0], 
                url: 'quotation.php', 
                dataType: 'json',
                async: false,
                success: function(result){
                    if (result){
                    oTable.fnAddData([
                        result.id,
                    result.date,
                    budget,
                    hospital[1],
                    dental[1],
                    optical[1],
                    doctor[1],
                    '',
                    '',
                    '',
                    'test'
                    ]);
            }
        loading.addClass('hidden');
                }
        });
    });
});

It work well but sometimes it send 3 or more query, how can I prevent this ? Normally It should send only one query.

  • 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-27T14:58:37+00:00Added an answer on May 27, 2026 at 2:58 pm

    When you click #add-quotation you bind another click event to #quotation_submit. Because you’re using live you can safely move it out. Try this:

    $("#add-quotation").click(function(event) {
        event.preventDefault();
        var customer_id = $(this).attr('data-customer');
        $.nmManual('#quotation_manage', {
            sizes: { // Size information
                w: 500,
                // Initial width
                h: 500 // Initial height
            }
        });
    });
    $('#quotation_submit').live('click', function(event) {
        event.preventDefault();
        if (typeof($.nmTop()) != "undefined") {
            $.nmTop().close();
        }
        var loading = $('.loading-notification');
        loading.removeClass('hidden');
        var date = $('#date_activate').val();
        var budget = $('#budget').val();
        var hospital = [$('#hospital').val(), $('#hospital option:selected').text()];
        var dental = [$('#hospital').val(), $('#hospital option:selected').text()];
        var optical = [$('#optical').val(), $('#optical option:selected').text()];
        var doctor = [$('#doctor').val(), $('#doctor option:selected').text()];
        $.ajax({
            type: 'POST',
            data: 'create=true&customer_id=' + customer_id + '&date=' + date + '&budget=' + budget + '&hospital=' + hospital[0] + '&dental=' + dental[0] + '&optical=' + optical[0] + '&doctor=' + doctor[0],
            url: 'quotation.php',
            dataType: 'json',
            async: false,
            success: function(result) {
                if (result) {
                    oTable.fnAddData([
                        result.id, result.date, budget, hospital[1], dental[1], optical[1], doctor[1], '', '', '', 'test']);
                }
                loading.addClass('hidden');
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form on a lightbox, that form is server side validated with
I have form area in my view. If I click button A , I
i have form action file in another directory but some file send to this
I have form with 1 button. when you click on the button 3 others
I have form, where some fields are looks like rows, so I can add/delete
I have a lightbox/modal that displays a form, but in select tag has a
Morning. I have a form which is rendered inside of a jquery dialog box
I have a problem in lightbox. This is the link when i clicked login
I have a nav button that loads a new page (create.html.erb) through Lightbox 2.
I have form in a ecommerce solution. I dont have access to the code

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.