My form is giving much problem with the part of the cadastre

-3

My site has the login forms, the registration form and the "Recover my password" side by side, I want to connect the registration form with my database, the login I already have, but the registration I still can not, I want to make a registration form using jQuery and Ajax , can someone help me connect? The name of my database is klp and the name of my table is table

<section class="containerreg">
  <h1><font color="#fb6e14">Sign Up</font></h1>
  <p id="cadastra"> </p>
  <form id="cadastra_user" method="POST" action="">
    <p><input type="text" name="name" value="" placeholder="Complet name"></p>
    <p><input type="text" name="user" value="" placeholder="Username"></p>
    <p><input type="text" name="email" value="" placeholder="E-mail"></p>
    <p><input type="password" name="senha" value="" placeholder="Password"></p>

    <button type="submit" value="Enviar" class="btn btn-primary" />Sign Up</button>
    </form>
</section>
<script type="text/javascript">
$(function(){
    $('#cadastra_user').submit(function(event){
        event.preventDefault();
        var formDados new FormData($(this)[0]);
        $.ajax({
            url:'http://127.0.0.1/projects/foodee/addUsuario.php',
            type:'POST',
            data:formDados,
            cache:false,
            contentType:false,
            processData:false,
            success: function(data){
                $('#cadastra').html(data);
                alert('Cadastrado com sucesso!');
            },
            dataType: 'html'
        });
        return false;
    });
});
</script>

This was the login page for the record that was sampled in the video, but it does not seem to work

Isthereanythingmissinginthevideo?SomeonehelpmeandpleasebecauseI'mnotsurewhattodotomakeitwork link

1

2

3

4

Type, agr until it is appearing that was registered (image 1), but nothing appears in my bd (image 2) and the business is that I have the right connections in the bd, both registration and login (images 3 and 4) ... right now, I thank everyone who is helping me and trying to help me.

    
asked by anonymous 07.11.2017 / 02:39

1 answer

0

Try to do so, you're missing an equal in the new FormData and url, as it's in the same place just put the name of the document, I commented at a glance

<section class="containerreg">
      <h1><font color="#fb6e14">Sign Up</font></h1>
      <p id="cadastra"> </p>
      <form id="cadastra_user" method="POST" action="">
        <p><input type="text" name="name" value="" placeholder="Complet name"></p>
        <p><input type="text" name="user" value="" placeholder="Username"></p>
        <p><input type="text" name="email" value="" placeholder="E-mail"></p>
        <p><input type="password" name="senha" value="" placeholder="Password"></p>

        <button type="submit" value="Enviar" class="btn btn-primary" />Sign Up</button>
        </form>
    </section>
    <script type="text/javascript">
    $(function(){
        $('#cadastra_user').submit(function(event){
            event.preventDefault();

            //AQUI FALTA UM IGUAL var formDados = new FormData($(this)[0]);

            var formDados = new FormData($(this)[0]);
            $.ajax({

                //Como está no mesmo local você poderia fazer assim somente 
                //deixar o nome do documento

                url:'addUsuario.php',
                type:'POST',
                data:formDados,
                cache:false,
                contentType:false,
                processData:false,
                success: function(data){
                    $('#cadastra').html(data);
                    alert('Cadastrado com sucesso!');
                },
                dataType: 'html'
            });
            return false;
        });
    });
    </script>
    
07.11.2017 / 14:33