0

I'm trying to get data from url using javascript. From the previous page I sent the data using $.redirect . The code snipet is below.

First the page redirects to another page sending data

$.redirect("index.html", {"name":"zayne"});

The page redirects perfectly but i have no way of now getting this data on the current page i redirected to.

Zayne komichi
  • 408
  • 4
  • 11
  • Does `$.redirect` add the values to the querystring? eg. yoursite.com?name=zayne – Rory McCrossan Jul 29 '21 at 13:31
  • i doubt, i tried accessing the url using `window.location.href` and `document.url` , if you are using php you can access them through the `$_POST` method, but i want to know how to do it in js – Zayne komichi Jul 29 '21 at 13:34
  • If the values are sent through a POST request you cannot directly retrieve them from client-side JS – Rory McCrossan Jul 29 '21 at 13:35
  • I marked two duplicates. The first covers the case where the `$.redirect` sends a POST request (which means you cannot access the values sent in client-side JS). The second covers the case where it sends a GET request and adds the values to the querystring. – Rory McCrossan Jul 29 '21 at 13:37
  • Thank you, found the answer – Zayne komichi Jul 29 '21 at 13:39

0 Answers0