Prevent Multiple Ajax Post Requests to a PHP script

The best testers are always the end users who actually use your application. Multiple minds have multiple variations to do. I faced an issue last week where some users can add one item in cart for 100 time by clicking a Add to Cart button 100 times. To avoid this issue I added the following jquery event handler to add to cart button.

$('#add_to_cart').one('click',function() {

//do your work here...


Jquery .one method is the simplest way to achieve this.

Leave a Reply

Your email address will not be published. Required fields are marked *