Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!