Help with wix code

Hi all, I have some code on a page that is used to re-direct to another page and pass some parameters. However in the url there are plus + signs that I would like to remove.

Here is the code:

import wixLocation from ‘wix-location’;
let url = wixLocation.url;
function getParametersAsString(url) {
return url.substring(url.indexOf(“?”), url.length)
}
$w.onReady( function () {
setTimeout(() => {
wixLocation.to(“https://myurl.com/forms/apply_2”+ getParametersAsString(wixLocation.url));
}, 100000);
});
export function button28_click(event) {
wixLocation.to(“https://myurl.com/forms/apply_2” + getParametersAsString(wixLocation.url));
}
export function button28_dblClick(event) {
wixLocation.to(“https://myurl.com/forms/apply_2” + getParametersAsString(wixLocation.url));

The result is a perfect redirect, either by time or button click. Here is the resulting url:-

https://www.myurl.com.au/thankyou60secapp-qualified?Name-first=Paul&Name-last=Jones&Mobile_Number=0411+111+111&Email=test@test.com

Can someone kindly assist to modify my code so it removes the plus sign in the Mobile Number field of the url. Thank you in advance.

Before adding the phone number to your URL, replace the plus signs with blanks. Something like this:

let phoneStr = "0411+111+111"
phoneStr = phoneStr.replace(/\+/g, "");

Do a web search for other possibilities and variations.

Hey Yisrael, thanks for the prompt response. I added your code to mine but it didn’t work. The original URL is a redirect created by a form. So basically I need the ‘return’ part of my code to convert this:

https://www.myurl.com.au/thankyou60secapp-qualified?Name-first=Paul&Name-last=Jones&Mobile_Number=0411+111+111&Email=test@test.com

into this:

https://www.myurl.com.au/thankyou60secapp-qualified?Name-first=Paul&Name-last=Jones&Mobile_Number=0411111111&Email=test@test.com