'Pass data to redirect page JS
I use fire base auth with javascript and i want to send client to his profile page using his id i want to send the userId through the window.location.href
I tried jquery post request but i didnt know how to send or recieve the data properly
I need an easy solution to my problem, Thanks.
$.post(
"./index.html",
{
id: user.uid,
},
function (data, status) {
alert("Data: " + data + "\nStatus: " + status);
}
);
Solution 1:[1]
By using query parameters you can pass data to redirect URL ./index.html?userId=1 and inside that page
you should have a read query parameter logic like.,
const params = new URLSearchParams(window.location.search)
for (const param of params) {
console.log(param)
}
I hope this solutions will work in your case
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kishan Vaishnani |
