Forums › Forums › Search & Filter Pro › Get URL after Ajax request
Tagged: ajax request, url
- This topic has 1 reply, 2 voices, and was last updated 3 years, 11 months ago by Trevor.
-
Anonymous(Private) December 31, 2020 at 4:41 pm #271451
Hi there!
I’m not sure if you’ll be able to help me or not, but this is my issue. I need to be able to force my page to reload after a certain amount of time. Following is the code I have to do this.
I have a meta tag to refresh the page:
<meta id="refresh" http-equiv="Refresh" content="60; URL=https://www.ddfl.org/adoption/">
And then when the buttons are clicked for the filter I update the URL portion of the content attribute so that it will be the URL with the filtered values in it (i.e., https://www.ddfl.org/adoption/?_sfm_animal_type=Cat). This is the code I have to do that:
(function($){ $(document).ready(function() { $('.sf-input-radio').click(function() { var currentURL = window.location.href; console.log(currentURL); var content = '60; URL=' + currentURL; // document.getElementById("refresh").setAttribute("content", content); $("#refresh").attr("content",content); }); }); })(jQuery);
The problem is, it will only return the base URL https://www.ddfl.org/adoption/ and will never update it with the filter values. I believe this might be because I am calling this on the radio button click and so maybe the ajax request has not completed and actually updated the URL yet. Is there a way for me to set an action after the url is updated with ajax?
Thank you for your help!!
Kristin
Trevor(Private) January 1, 2021 at 10:14 am #271476Are you looking to fetch the query string then? Whilst not really within the scope of our support, something as suggested by this stackoverflow page suggests:
https://stackoverflow.com/questions/4656843/get-querystring-from-url-using-jquery
Or similar searches:
https://www.google.com/search?q=use+jquery+to+fetch+query+part+of+url+site:stackoverflow.com
-
AuthorPosts