Ajax, JQuery Records Duplication

2

I have an HTML page to confirm items for a goods transfer.

In it, jQuery, AJAX is used with the option async: false and VRaptor.

I did the following test:

  • I created a multi-item download.
  • After downloading, I went to the confirmation screen to confirm receipt of the items.
  • I confirmed all of them and clicked the end button. This button triggers the event that scans the screen and sends the parameters of the confirmed items (such as PK keys) to the server that will persist the data.

The process works correctly when a user is logged in using a browser.

The problem happens when the logged-in user resolves to use two browsers and clicks the 'finish' button in both browsers. This generates duplicate records in the database.

How can I solve the problem, since I can not have a lock for the same user, and if it uses two browsers (same or not), prevent it from duplicating records in the database?

    
asked by anonymous 27.05.2014 / 20:06

1 answer

1

There may be two situations:

1 - When the user clicks on the button, implement the hide click of the button to prevent it from being clicked 2 times.

2 - use stopPropagation () on event to prevent event replication between tags

link

link

    
15.08.2014 / 22:45