3
I need to know the correct way to when I submit a form a single script solve, the code below only works if I create a script for each form. How do I fix it?
Example: $("#meuform") ... $("#meuform2") ... $("#meuform3"), etc..
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title> teste </title>
    <meta name="" content="" />
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.form.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $(".resultado").hide();
            $("#meuform").ajaxForm({
                target: '.resultado',
                success: function(retorno){
                     $(".resultado").html(retorno);
                     $(".resultado").show();
                     $("#meuform").resetForm();
                }
            });
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function() {
            $(".resultado").hide();
            $("#meuform2").ajaxForm({
                target: '.resultado',
                success: function(retorno){
                     $(".resultado").html(retorno);
                     $(".resultado").show();
                     $("#meuform2").resetForm();
                }
            });
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function() {
            $(".resultado").hide();
            $("#meuform3").ajaxForm({
                target: '.resultado',
                success: function(retorno){
                     $(".resultado").html(retorno);
                     $(".resultado").show();
                     $("#meuform3").resetForm();
                }
            });
        });
    </script>
    </head>
    <body>
    <div class="resultado"> aqui é o reultado</div>
    <div class="formulario">
        <form method="POST" action="processafrm.php?var=10" id="meuform">
            nome:<br />
            <input type="text" name="nome" size="50" /><br />
            Email:<br />
            <input type="text" name="email" size="50" /><br />
            <input type="submit" name="enviar" value="Enivar dados" />
        </form>
    </div>
    <div class="formulario">
        <form method="POST" action="processafrm.php?var=10" id="meuform2">
            nome:<br />
            <input type="text" name="nome" size="50" /><br />
            Email:<br />
            <input type="text" name="email" size="50" /><br />
            <input type="submit" name="enviar" value="Enivar dados" />
        </form>
    </div>
    <div class="formulario">
        <form method="POST" action="processafrm.php?var=10" id="meuform3">
            nome:<br />
            <input type="text" name="nome" size="50" /><br />
            Email:<br />
            <input type="text" name="email" size="50" /><br />
            <input type="submit" name="enviar" value="Enivar dados" />
        </form>
    </div>
    </body>
    </html>
Code worked perfectly and completely solved the question I just made a small change to reset the form where it was self.resetForm(); it was like $(self). resetForm();
– Adrianoecris