1
I have this code in my JS:
$('#form-sign-in').bind('submit', function(e)
And in my FORM
has a Input Type Submit
. When I click on it to make a simple registration, it is sending two requests.
I’m using ajax.
I see in Google’s Inspect Element in the tab XHR and shows me two requests for the registration page.
$.ajax({
type: "POST",
url: baseURL + '/form-cadastro',
data: $(this).serialize(),
beforeSend: function(){
$("#confirmar-cadastro").val('Aguarde...').prop('disabled');
},
success: function(result){
$('input, label').hide();
$('.message').html(result).addClass('message');
setTimeout(function(){
$('.message').html('').addClass('message');
$('input, label').show();
$("#confirmar-cadastro").val('Confirmar').removeProp('disabled');
}, 4000);
}
});
Switch your button to button type.
– Marconi
@Marconi, it wasn’t just that. But it helped.
– Diego Souza
How nice to have helped you @Diegosouza.
– Marconi