As the title said...
Some of my code: there is more inputs but i'll put this one just to simplify.
<form name="frmCadastroPlano" id="frmCadastroPlano" class="form-horizontal" >
<input class="input-xlarge" id="inputNome" name="inputNome" type="text" value="" style="height: 26;">
<button type="submit" class="btn btn-primary" id="enviar">Cadastrar</button>
<button class="btn" name="clear" id="clear">Cancelar</button>
<div id="resposta"></div>
</form>
Ajax code :
$("#frmCadastroPlano").submit( function(e) {
e.preventDefault();
dataString = $("#frmCadastroPlano").serialize();
$.ajax({
type: "POST",
url: "cadastroPlano.php",
data : dataString,
dataType: "html",
success: function(retorno) {
$("#resposta").html(retorno);
resetForm('frmCadastroPlano');
}
});
return false;
});
When i press the button first time all inputs serializes in the url, like GET Method... Example url.php?inputNome=asdas&inputDuracao=asdasda&inputPreco=asdas... The form is then reseted and i have to type the data again so i can finally then submit... i've seen another answer to this similar question but no luck :/ Sry English.
OutPut with alert(dataString) inputNome=asda&inputDuracao=dsadas&inputPreco=dasdas