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

208
Visualizações
Run JavaScript after Form Submit (Wordpress + WPPayForm)

I have a payment form on my Wordpress page and I would like to run a javascript code, after the form submit.

This is the code I'd like to submit:

ny.track({name: (new URL(window.location.href)).searchParams.get("utm_source"), value: 24.50, unit: "CHF"})

This is what I have on my Wordpress page:

jQuery(".wpf_submit_button").submit(function() {
     ny.track({name: (new URL(window.location.href)).searchParams.get("utm_source"), value: 24.50, unit: "CHF"});
    });

Unfortunately, this does not seem to work. If I change this to fire on click (eg. jQuery(".wpf_submit_button").click(function... then it works without any problem, so I'm not sure what I'm doing wrong. Here is the link to a testpage with the code implemented. I am using WPPayForm for the payment form.

Any help is greatly appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

.submit() is bound to the "Submit" javascript event according jQuery documentation. You should use your form id instead of the button class as jQuery selector:

jQuery("#wpf_form_id_354").submit(function() {
 ny.track({name: (new URL(window.location.href)).searchParams.get("utm_source"), value: 24.50, unit: "CHF"});
});

Check jQuery docs: https://api.jquery.com/submit/

The submit event is sent to an element when the user is attempting to submit a form. It can only be attached to <form> elements.

about 4 years ago · Juan Pablo Isaza Relatório
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