I am building a form where I send the data to my database, only type in that form wanted to run 2 actions
on a submit
button only which in the case actions
are id="ajax_form"
and id="step2Button"
.
How can I execute both in my code, ajax sends the form and step2, continues the form a second part?
This is the id="ajax_form"
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#ajax_form').submit(function(){
var dados = jQuery( this ).serialize();
jQuery.ajax({
type: "POST",
url: "processar.php",
data: dados,
success: function( data )
{
alert( data );
}
});
return false;
});
});
</script>
And this is the id="step2Button
$(document).ready(function(){
location();
$('#step2Button').click(function(){
if($('#username').val()==""){
swal("Error", "Nome de usuario requerido!", "error")
}
if($('#senha').val()==""){
swal("Error", "Senha requerida!", "error")
}
else{
$('#step1').fadeOut(500,function(){
$('#step2').fadeIn(500);
});
}
return false;
});
This top, continues in the same form, type a second part of the form after sending the first ..