What's the function of oxidized metal?

Whats wrong with how i set up the setInterval() function?

  • Im using AJAX to get some data and i would like to refresh the data but when i get one "friend_id" and then another, i get what i think are to intervals because one list loads on top of another over and over. function open_chat(friend_id){ var friend_id = friend_id; var hr = new XMLHttpRequest(); var refresh = null; if(refresh) clearInterval(refresh); refresh = setInterval(function(){ var url = "friends.php"; var vars = "friend_id="+friend_id; hr.open("POST", url, true); hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { var return_data = hr.responseText; document.getElementById("table").in… = return_data; } } hr.send(vars); },1000); }

  • Answer:

    You need to include the lower bound and upper bound for your interval... Good luck!

Hector at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.