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

  • Home
  • SEARCH
  • 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 8486823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:03:47+00:00 2026-06-10T21:03:47+00:00

I am trying to add a new record in a table with the following

  • 0

I am trying to add a new record in a table with the following code, using jQuery ui dialog and confirm boxes. If I double click on the confirm button the record will be added twice in the database. How can I prevent this?

function AddNewClient(){    
            jQuery("#confirmdialog").html("are you sure");
            jQuery("#confirmdialog").dialog({
                  modal: true,  
                  buttons : {
                    "Confirm" : function() {                                                                                            
                        jQuery.ajax({
                              type: "POST",                           
                              url: "index.php?option=com_travelagencycrm&view=clients&task=AddNewClient&format=raw",
                              cache: false,     
                              data : {id:jQuery("#client_id").val(),
                                      fullname:jQuery("#fullname").val(),
                                      vat_id:jQuery("#vat_id").val(),                                     
                                      address:jQuery("#address").val(),
                                      state_id:jQuery("#state_name").val(),
                                      country_id:jQuery("#country_name").val(),
                                      email:jQuery("#email").val(),
                                      phone_1:jQuery("#phone_1").val(),
                                      phone_2:jQuery("#phone_2").val(),
                                      postalcode:jQuery("#postalcode").val()                                    
                                }
                            }).done(function(msg) {         

                                jQuery("#tablepanelclients").flexReload();
                                //alert(msg);
                                jQuery("#confirmdialog").dialog("close");
                                jQuery("#editclient").dialog("close");                              

                            }).error(function(msg){
                                alert(msg);
                                jQuery("#confirmdialog").dialog("close");
                                jQuery("#editclient").dialog("close");
                            });


                    },
                    "Cancel" : function() {
                        jQuery(this).dialog("close");
                    }
                  }
                });

              jQuery("#confirmdialog").dialog("open");

        }
  • 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-06-10T21:03:49+00:00Added an answer on June 10, 2026 at 9:03 pm

    One client-side solution is to add a boolean :

    var sent = false;
    

    …

      buttons : {
                    "Confirm" : function() { 
                        if (sent) return;
                        sent = true;                                                                                           
                        jQuery.ajax({
    

    Another more robust solution would be to do server side the check that you didn’t yet insert those data. I would generally prefer this as any kind of problem or attack can happen outside the server (on the browser or the network).

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

Sidebar

Related Questions

I am trying to add a new record to my internal table and this
I am receiving a NullReferenceException when trying to add a record to a table
I'm using the following code in an ASP.NET page to create a record, then
Using the following code: using (ICMSEntities db = new ICMSEntities()) { productObj.Sectors.Clear(); int[] selected_sectors
i am trying to display the 'add new record' display in jqgrid but it
I am trying to use Formalchemy to add a new record to my SQLAlchemy
Im new to asp.net mvc. I'm trying add new model class but it got
I'm trying to add a new nova-compute node (KUubuntu 12.04) to my single node
I am trying to add a new column into an SQLiteDatabase but every time
I'm trying to add a new JDBC Data Source connect to hive in oracle

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.