简体   繁体   中英

i have created a online typing test page using javascript and ajax. the code is working fine in google chrome firefox, but not in internet explorer

In internet explorer, the same response is received again when i refresh the words. here is the function in which the words list is being refreshed on onclick event.

function refresh() {

            // divs in which words to be set


            var xmlhttp;
                if (window.XMLHttpRequest)
                  {// code for IE7+, Firefox, Chrome, Opera, Safari
                  xmlhttp=new XMLHttpRequest();
                  }
                else
                  {// code for IE6, IE5
                  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                  }


            xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4 && xmlhttp.status==200) {

                /*

                ------------

                -----------
                logic in which words are received from database in a para and then separated and inserted in 
                div where words are to be displayed.

                -----------
                -----------

                */


                } 
            xmlhttp.open("GET","getdata.php",true);
            xmlhttp.send();

            }// refresh

In getdata.php a para from the database is selected randomly and then words are separated in the above if block. The entire code is properly working in all browsers (ie random paragraphs are received), but in internet explorer the same paragraph which is loaded first time is recieved again and again.

I am totally confused why it is not working in IE. If anybody has an idea, please tell me why this is happening and what modifications are required to be made.

For more clarification about the problem, please check this link http://www.geekzgarage.com/typing-test/ in chrome and click on refresh image. YOu'll see the random words each time. But in IE the same words will be there after each refresh. Note: this problem might have solved on the link mentioned above.

May be the request to getdata.php is cached by the browser. Try adding the timestamp at the end of the URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM