Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7902157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:25:33+00:00 2026-06-03T09:25:33+00:00

I’m currently working with an e-commerce shopping site where different products require to be

  • 0

I’m currently working with an e-commerce shopping site where different products require to be rated. I’m using a star rating script.

Everything is working fine but a product should be rated only once according to the visitor’s IP and once the visitor clicks a star (among the five stars), all the stars should be disabled so that duplicate rating for the same product with the same IP can be prevented (I’m also using serve side validations) and average rating according to the new value from the database should be indicated by the same stars (which have just been disabled).

It’s working on Firefox with no problem at all. When a visitor clicks a star a new value is passed to the database (using Ajax) and according to the new value, average rating is calculated and displayed but Internet explorer is unable to retrieve the new value from the database using Ajax.

I’m just demonstrating the problem with very simple code as follows.

Following is Temp.php file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript" language="javascript">
    var xmlhttp;        
    function ajax()
    {
        if(window.XMLHttpRequest)
        {
            xmlhttp=new XMLHttpRequest();
        }
        else
        {
            xmlhttp = new ActivexObject("Microsoft.XMLHTTP");
        }
    }

    function loadStars(prod_id)
    {
        ajax();

        xmlhttp.onreadystatechange=function()
        {           
            if(xmlhttp.readyState==4 && xmlhttp.status==200)
            {                               
                document.getElementById("ajax_response").innerHTML=xmlhttp.responseText;
                var rating= document.getElementById("rating_value").value;              
                alert(rating);   //Rating value of hidden field from the ajax response is alered.               
            }
        }

        var queryString="Temp1.php?prod_id="+prod_id;
        xmlhttp.open("GET", queryString, true);
        xmlhttp.send();             
    }
</script>
</head>

<body onload="loadStars(11);">
    <span id="ajax_response"></span>
</body>
</html>

and the following is the Temp1.php


<?php
    include_once("../Connection.php");  
    $con=new Connection();
    $con->get_connection(); 

    if(isset($_GET['prod_id']))
    {           
        $result=mysql_query("select rating_num from rating where prod_id=".$_GET['prod_id']."");
        $rating=mysql_result($result, 'rating_num');        
        echo "<input type='hidden' id='rating_value' name='rating_value' value='$rating'/>";                                                                    
    }
?>

The code in both the files has nothing to do with. The js function loadStars(prod_id) is called on the onload event (look at the body tag) which actually invokes the Ajax request to the Temp1.php which retrieves rating_num from the database and simply stores into a hidden field named rating_value which is finally alerted on the Temp.php file using alert(rating);

The actual question is here when the value of rating_num is changed in the database, Firefox displayed the updated value which is essential BUT Internet explorer (8) still displays the old value even though the page is refreshed and reload again and again.

What should be the reason? Is there any solution to this problem? Hope you will be able to understand what I mean.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:25:35+00:00Added an answer on June 3, 2026 at 9:25 am

    Internet Explorer does some funny stuff with caching sometimes. It tends to take a much more intense approach to caching than other browsers. The cache is a great thing when we normally access the same resource twice, three times, or more. In the cases of static content, we actually want the browser to be smart enough to not request data it already has retrieved, as this saves time and bandwidth.

    However, AJAX requests are different in that they are generally dynamic. The same request made at one moment in time may of course yield a completely different result at another moment in time. As a result, we don’t normally want to cache an AJAX request.

    However, IE’s intense caching becomes a problem when it comes to AJAX requests. The browser treats an AJAX request just like it would a request for a static, unchanging image, and it pulls the previous results of that request from it’s cache as if nothing has changed.

    This is of course not something that you want Internet Explorer to do. Thus, the quickest and simplest technique you can use to force IE to pull fresh data is to make a slight modification to the URL each time.

    Lucky for us, time is something that constantly moves forward, and by its very nature, it is guaranteed to be unique. Here is how you can avoid this problem:

    var queryString="Temp1.php?prod_id="+prod_id + "&t=" + new Date().getTime();
    

    By appending the epoch time to the end of the query string, we ensure that the URL will always be unique, ensuring that the browser always grabs fresh content from the server.

    I use this technique on all of my AJAX requests and have found it to be extremely valuable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.