Hola, estoy intentando con jquery enviar un formulario y si tiene algo mal que me lo ponga en un div el error. Pero el problema es que cuando pulso el submit hace lo que hace el ajax y luego hace como le submit normal y se va a la url del action. yo no quiero que se vaya al url del action simplemente quiero que lo haga con ajax. no se que puedo estar haciendo mal.
Por ejemplo os pongo este ejemplo: Quiero que cuando pulse el submit me haga el alert y nada mas:
Código:
<html>
<head>
<title>Formulario dinamico</title>
<script src="jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function (){
//alert("READY");
$("#formid").submit( function (){
alert("SUBMIT");
});
});
</script>
</head>
<body>
<form id="formid" method="post" action="procesaajax.php"><br/>
Nombre * <input type="text" name="nombre" /><br/>
Email * <input type="text" name="email" /><br/>
Empresa <input type="text" name="empresa" /><br/>
Teléfono * <input type="text" name="telefono" /><br/>
Fax <input type="text" name="fax" /><br/>
Web <input type="text" name="web" /><br/>
<input type="submit" value="Enviar"/>
</form>
<div id="resultados"></div>
</body>
</html>