Why is my contact form not submitted?

Asked

Viewed 106 times

0

Good afternoon,

Guys, I’m having a problem with the contact form. Here’s a preview.

In this link it is working normally

bit.ly/2sPnWJg

Already in this link, which is the same action, even link it does not work.

bit.ly/2sAvuQP

<div class="container">
<div class="row">
    <div class="col-md-11">
        <form action="/mail/envia.php" method="post" id="Form_Envio">
          <div class="form-group">
            <label for="exampleInputEmail1">Qual Assunto?</label>

            <select name="options" class="form-control" required>
              <option value="">Selecione</option>
              <option value="Dúvidas">Dúvidas</option>
              <option value="Meu Pedido">Meu Pedido</option>
              <option value="Troca">Troca</option>
              <option value="Assuntos Diversos">Assuntos Diversos</option>
              <option value="Retorno - Desistência">Retorno - Desistência</option>
            </select>
          </div>

          <div class="form-group">
            <label>Nome:</label>

            <input maxlength="100" name="name" class="form-control" id="Nome"/>
          </div>

          <div class="form-group">
            <label>E-mail</label>
            <input type="email" maxlength="50" name="email" class="form-control" id="email"/>
          </div>

          <div class="form-group">
            <label>Telefone</label>
            <input size="15" name="phone" class="form-control" id="Telefone" />
            </label>
          </div>

          <div class="form-group">
            <label>Mensagem</label>
            <textarea cols="60" name="message" rows="10" wrap="physical" class="form-control" id="message"></textarea>
          </div>

          <div class="form-group">
            <input type="submit" value="ENVIAR" border="0" name="image2" width="75" height="25" />
          </div>
        </form> 
    </div>
</div>

  • Console message: Origin 'http://loja.bluebeach.com.br' is therefore not allowed access maybe the address of the php server you are posting to is not CORS enabled.

  • I’m gonna check out @Lucascosta

  • @Lucascostat to activate CORS I use this header code('Access-Control-Allow-Origin:*'); in the file send.php right? If that’s it, I took the test and it didn’t work =/

1 answer

1


Why don’t you send via Ajax ?

jQuery(document).ready(function(){
jQuery('#id-do-formulario').submit(function(){
  var dados = jQuery( this ).serialize();

            jQuery.ajax({
              type: "POST",
              url: "http://url",
              data: dados,
              success: function( data ) {
                console.log("voce pode logar uma mensagem caso foi enviado");
                console.log(data);//e pegar o retorno aqui com a variavel data caso seja submetido com sucesso.

              },
              error: function (result) {

                console.log(result);
                } 



  });


  return false;
   });
});
  • I will take this test. If I have 3 forms on different pages, can I put them with the same id? JS will recognize?

  • If they are different pages and you put the JS inside the page I believe so, the problem is 3 forms of the same ID on the same page, because sending all the data of the 3 forms will conflict. By default and to organize I change the IDS but being different pages I believe it works yes.

  • It worked on a server, now I’m going to test what’s wrong. It may take a while because it’s the people from the site that play there on the server, but as soon as they give a feedback, I notice here.

  • Beauty if it works you mark as solved, thanks! any doubt just talk.

  • Felipe the lock was on the platform of the system, it was not problem with the code, but its code worked perfectly, even I have already left it saved here for when you need. Thanks for the help, problem solved.

  • For nothing my dear need only speak, the ajax and a very interesting refuse and it does not reload the page .

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.