2
I’m putting together a form where I send the data to my database, only what kind of form I wanted to run 2 actions
on a button submit
only that in the case actions
sane 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 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 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;
});
The top one, continues in the same form, like a second part of the form after sending the first..
just create a function (
function
) and call the two actions.– novic
Sorry Virgilio, I tried in many ways could help me with the code?
– LeoS
What is the sequence of execution
– novic
First sends ajax_form after step2Button
– LeoS