0

My problem with anonymous users caching. in my site there is functionality of changing country selecting from drop down box. for now there is 2 countries "A & B" and default is Country A. when i am selecting country B from drop down it will change country B and load data according to that country.

I have done this by change event of drop down box in jquery.

When logged in user can go for change country it will working fine. But anonymous user can not change country it will load previously selected country data. means my default country is A and i am going to change Country B it will not change to Country B.

And when I am clear cache from admin and first time change country for anonymous user it will change country but than after it will not change country until I clear cache from admin.

below code i used for changing country

$(document).ready(function(){
           $('#selCountry').change(function(){
                var country = $(this).val();
                if(country != ""){
                    createCookie('userCountry', country, 30);
                    window.location.href = '<?php echo $GLOBALS['base_path']; ?>';
                }
            });
        });
  • If we will ever be able to help you, it will be when you will share code you have used to implement this. Now it's mystery, there are dozens of ways, each with it's own traps. Long story short, if you cache a page under an address, it is cached. Either do not cache it, cache it but load dynamic elements with js, or cache each version under different address. – Mołot Dec 5 '13 at 9:26
  • You can check this link letseatoutguide.com – Pranav Gandhi Dec 5 '13 at 9:33
  • Nope. I mean I could check that link but I'm here to answer questions, not to do a consultant's work for free. And your comment with that link looks like spam. If it'll get flagged as spam you may be banned. – Mołot Dec 5 '13 at 9:35
  • @GandhiPranav Please edit your question to include the code you're having problems with. All information pertinent to the problem needs to be here, not in an external website. Thanks – Clive Dec 5 '13 at 9:35
  • window.location.href = '<?php echo $GLOBALS['base_path']; ?>'; How does that even work? Where have you put this code to make it work?! – Mołot Dec 5 '13 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.