php - when 'add to cart' button is clicked ,it should be disabled until product is removed from the user's cart page
Get the solution ↓↓↓Solution:
you use btn.loading and btn.reset. save your btn as a variable to avoid clashes when the scope changes.
$('.add_to_cart').on('click dblclick',adding);
//$("body").on(".add_to_cart","click",adding);
function adding(e) {
var cur = $(this).button("loading");
e.preventDefault();
var prodid =$(this).attr("id");
var that = $(this);
that.off("click dblclick");
$.ajax({
type: "POST",
url: "addcart.php",
data:{prodid:prodid}
}).done(function(msg) {
alert(msg);
}).always(function() {
that.off("click dblclick",adding);
cur.reset()
})
};
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: sqlstate[hy000] [1698] access denied for user 'root'@'localhost'
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.