| 1 |
jQuery(document).ready(function ($) { |
| 2 |
$('.pagar-etiqueta').click(function (e) { |
| 3 |
e.preventDefault(); |
| 4 |
|
| 5 |
var order_id = $(this).data('order-id'); |
| 6 |
|
| 7 |
$.ajax({ |
| 8 |
url: ajaxurl, |
| 9 |
type: 'POST', |
| 10 |
data: { |
| 11 |
action: 'pagar_etiqueta_superfrete', |
| 12 |
order_id: order_id |
| 13 |
}, |
| 14 |
beforeSend: function () { |
| 15 |
alert('Processando pagamento...'); |
| 16 |
}, |
| 17 |
success: function (response) { |
| 18 |
if (response.success) { |
| 19 |
alert(response.data.message); |
| 20 |
location.reload(); |
| 21 |
} else { |
| 22 |
alert(response.data.message); |
| 23 |
} |
| 24 |
} |
| 25 |
}); |
| 26 |
}); |
| 27 |
}); |