Created
March 14, 2014 13:00
-
-
Save jelukas/9547235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="post" class="formulario-early-suscriber" id="form-plan-anual"> | |
<input name="email" placeholder="Escribe tu Email" type="email" required> | |
<input name="plan" value="anual" type="hidden"> | |
<input name="precio" value="195 eur" type="hidden"> | |
<button class="submit-form" data-em="button" type="submit">Avísame Cuando esté Listo</button> | |
</form> | |
<!-- Javascript Code --> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('.formulario-early-suscriber').on('submit',enviar_email); | |
function enviar_email(ev){ | |
ev.preventDefault(); | |
var url = "early_suscribe.php"; | |
var form = this; | |
$.ajax({ | |
type: "POST", | |
url: url, | |
data: $(form).serialize(), // Adjuntar los campos del formulario enviado. | |
success: function(data){ | |
parent = $(form).parent(); | |
parent.find('.close-link').remove(); | |
$(form).hide(); | |
parent.append('<p class="alert alert-success early-suscribe-success">'+data+'</p>'); | |
} | |
}); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment