Skip Navigation

[Résolu] I would like to remove a pesky query string from a cred form submission

This support ticket is created Il y a 5 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Marqué : 

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par Adrian Il y a 5 années et 3 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1318467

Hi, I have a CRED form that changes the current user on submit.
Ajax is off and it refreshes the page on submit.

Problem is that it adds some query string to the URL, and I'd like to get rid of that.
`webtemple.io/?_tt=1566115370&_success=285_1&_target=1#cred_form_285_1`

Status messages are not important for my application here.

How can I accomplish that?
Thank you

#1318591

Hi, Forms requires those URL parameters in certain circumstances so there are no options available for suppressing them. If you'd like to remove them completely, you would have to implement custom JavaScript to manipulate the URL hash after the page loads. Here's a Stack Overflow post with a couple of examples: https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page

#1318655

Thank you!
That is exactly what I was looking for!

I will just add the code from the page here, so others can find it easier:

1- To modify current URL and add / inject it (the new modified URL) as a new URL entry to history list, use pushState:

window.history.pushState({}, document.title, "/" + "my-new-url.html");

2- To replace current URL without adding it to history entries, use replaceState:

window.history.replaceState({}, document.title, "/" + "my-new-url.html");

via https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page