When I click the "Hire" button it makes two requests on the server at once, how can I avoid this?
<button type="button" class="pagar" id="10.00">Contratar</button>
Ajax
$(document).on('click', ".pagar", function () {
preco = $(this).attr('id');
$.ajax({
url: path + 'Usuario/efetuarPagamento',
type: 'POST',
data: {preco: preco},
success: function (response) {
console.log(response);
}, error: function () {
console.log(erro, er);
}
});
});