lundi 20 juin 2016

ajaxForm after submit goes to php page instead of staying

I'm trying to use an ajaxForm for submit 10 forms in one page. So I tryed this steps,but in first time that I open my page, ajaxForm does not work and goes to php page (a white page) instead of staying!

1- I added jquery and jqueryForm:

    <script src="js/jquery-1.7.js"></script>
    <script src="http://malsup.github.com/jquery.form.js"></script>

2- Define ajaxForm() for every my forms:

   $(document).ready(function() {
       $('#formP2').ajaxForm(function() {
           alert("Page 2 submitted!");
           $('#page02').collapsible('collapse');
           $('#page03').show();
           $('#page03').collapsible('expand');
       });
       $('#formP3').ajaxForm(function() {
           alert("Page 3 submitted!");
           $('#page03').collapsible('collapse');
           $('#page04').show();
           $('#page04').collapsible('expand');
       }); 
...}

3- I write my forms:

<form class="form-inline" role="form" method="post" action="php/formUserP1.php" 
id="formP1" name="formP1" enctype="multipart/form-data">
<input type="submit" class="form-control dont-print" data-icon="arrow-l" data-inline="true" name="next02" id="next02">
</form>
<form class="form-inline" role="form" method="post" action="php/formUserP2.php" id="formP2" name="formP2">
</form>
...

In first time, This is not work. When I submit any form, page goes to php file and a white page. But when I refresh page this works well! Please help me!

Aucun commentaire:

Enregistrer un commentaire