I am having problem with this AJAX code.
It shows a confirmation pop up window before executing the code and changing the data.
However, whether I confirm or delete, it pops up twice. So the data query is executed twice.
Here is the code:
$('#approveOrder').on('click', function() {
var requestNumber="<?php echo $request_number; ?>";
confirmQuestion = confirm('You are about to approve order number: ' + requestNumber + ' confirm?')
if (confirmQuestion) {
$.ajax({
url: "<?php echo base_url('orders_dashboard/approve'); ?>",
type: "POST",
data: {
requestNumber: requestNumber,
orderId: "<?php echo $order_list[0]['order_id']; ?>",
orderValue: "<?php echo $tentative; ?>"
},
success: function() {
location.reload()
}
})
}else{
return false;
}