Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
Is there a better way to intercept the default Shopify customer login form and make it AJAX?

So the default form is placed by Shopify using the following liquid:

   {%- form 'customer_login' -%} 

I have created this hidden div for the Ajax response from /account/login:

  <div id="responseDiv" style="display: none"> </div>

Here’s the Ajax Script:

  var frm = $('#customer_login');

frm.submit(function (e) {

    e.preventDefault();

    $.ajax({
        type: frm.attr('method'),
        url: frm.attr('action'),
        data: frm.serialize(),
        success: function (data) {
          
              $('#responseDiv').html(data);
           if($.         ('#responseDiv .errors').length &gt; 0){
     console.log("ERRORS FOUND").    
       } else {
       location.reload();
      }},});});

With this script there’s a couple of issues when the form has errors, I’m quite new to JavaScript and would greatly appreciate it if anyone can provide/ helms me find a better way to achieve what I’m trying to do, thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda