How to combine confirm and ajax
laurencei opened this issue · comments
Laurence commented
Hi,
How do I combine the confirm with an ajax request if they accept?
i.e. I have this code
$(".confirm-action").popConfirm();
and I have this code
$('.confirm-action').click(function(e){
e.preventDefault();
$.ajax({
// Ajax stuff here
});
});
How do I make it that the ajax only fires if they click accept?
Anael FAVRE commented
Hi and thanks for using PopConfirm.
What is the actual behaviour of PopConfirm in your case ?
Anael FAVRE commented
This is an example i wrote using using jquery $.get
(similar to $.ajax
).
Please do not use e.preventDefault();
where it break the action chain required by PopConfirm triggers.
Anael FAVRE commented
I close this issue as you did not respond in two weeks :)
I hope that my snippet helps you.