I have the following form and its validations. How would I do to call a gif (preloader) for the form at the moment the user clicks to send. It should disappear when the ajax is finished.
function solucoesForm() {
if ($.trim($('#soluctionsName').val()) == '' || $.trim($('#soluctionsName').val()) == 'Nome') alert('Informe seu nome!');
else if ($.trim($('#soluctionsEmail').val()) == '' || $.trim($('#soluctionsEmail').val()) == 'E-mail') alert('Informe seu e-mail!');
else if ($.trim($('#soluctionsPhone').val()) == '' || $.trim($('#soluctionsPhone').val()) == 'Telefone') alert('Informe seu telefone!');
else if ($.trim($('#soluctionsEmpresa').val()) == '' || $.trim($('#soluctionsEmpresa').val()) == 'Empresa') alert('Informe a Empresa!');
else if ($.trim($('#soluctionsCidade').val()) == '' || $.trim($('#soluctionsCidade').val()) == 'Cidade') alert('Informe sua Cidade!');
else {
$.post('carregamentos/solucoes.php',
$('#solucoesFormulario').serialize(),
function(abc) {
alert('Mensagem enviada com sucesso!');
}
);
}
return false;
}
<form class="contact soluctionsForm margin-top-190 margin-bottom-110" id="solucoesFormulario" action="" name="solucoesFormulario" method="post" onsubmit="return solucoesForm();">
<div class="grid_380 float-left">
<div class="margin-bottom-30">
<h2>Solicite um orçamento</h2>
<h2>para esta solução</h2>
</div>
<input type="text" class="margin-bottom-20 grid_380" name="Nome" placeholder="Nome" id="soluctionsName" />
<input type="text" class="margin-bottom-20 grid_380" name="E-mail" placeholder="E-mail" id="soluctionsEmail" />
<input type="text" class="margin-bottom-20 grid_380" name="Telefone" placeholder="Telefone" id="soluctionsPhone" />
<input type="text" class="margin-bottom-20 grid_380" name="Empresa" placeholder="Empresa" id="soluctionsEmpresa" />
<input type="text" class="grid_380" name="Cidade" placeholder="Cidade" id="soluctionsCidade" />
<input class="grid_380 margin-top-25" type="submit" name="Enviar" />
</div>
</form>