javascript - PHP Page content loads from cache when loading same page multiple times -
i displaying shopping cart products reading session variables.
if product added in page1 , setting session array variable. after navigating page2 loading session content display product in shopping cart in page2.
then if add product in page2 going page1 , page1 not showing refreshed content, instead takes content page1 cache.
but when f5 or ctrl+f5, works fine...
i want page not load cache everytime when visit if same page.
here code:
<?php echo "<script> $(document).ready(function() {"; echo "add1('".$session_variable."')"; echo "});</script>"; ?> <script> add1(item) { document.getelementbyid('itemname').value=item; } <script>
edit: navigate page 1 page2 using onclick event below..
<a onclick="window.location='page2.php'" style="text-decoration:none">page2</a><br> <a onclick="window.location='page1.php'" style="text-decoration:none">page1</a><br>
i added following lines, no use.
<meta http-equiv="pragma" content="no-cache,must-revalidate"> <meta http-equiv="expires" content="-1">
how navigate back one, have url clicked navs or use window.history.back()?
if using javascript nav may issue. when navigating page 1 use url cache break @ end of so
window.location.href = "/page1.php?cb=" + math.random();
Comments
Post a Comment