Forums Forums Search & Filter Pro Get URL after Ajax request

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #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
    #271476

    Are 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

Viewing 2 posts - 1 through 2 (of 2 total)