Skip Navigation

[Resolved] Run javascript after form submit

This thread is resolved. Here is a description of the problem and solution.

Problem:

The customer asked how can the page with the Toolset form be refreshed when the form is submitted using the AJAX.

Solution:

Shared a custom script to include in the form's "JS editor":


jQuery(document).ajaxComplete(function (event, xhr, settings) {
     parent.location.reload();  
});

Relevant Documentation:

n/a

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by mikeH-3 3 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2225931

I have a frontend form using CRED. I am using this code to represent the save button for this form:

[cred_field field='form_submit' output='bootstrap' value='Save' class='btn']

How do I get it so that once someone hits this submit button in the frontend, it runs this code:

javascript:parent.location.reload();

#2226539

Hi,

Thank you for contacting us and I'd be happy to assist.

I'll assume that you have a Toolset Form on a page that is set to submit using AJAX and you'd like to refresh the page when the form submission completes.

If that is correct, you can include the following script in the form's "JS editor":


jQuery(document).ajaxComplete(function (event, xhr, settings) {
     parent.location.reload();  
});

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2228063

My issue is resolved now. Thank you!