mikebarbaro
10-11-2010, 08:27 AM
I have the following code that changes the contents of a <div> once the ajax result is loaded. The problem is where I am trying to load in quote_feed.php it keeps reloading that section over and over again. I think it's because the loop continues to reload. Please help! I've been working for days on this and I think it should be an easy fix.
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('insert_response').innerHTML = '<div width="400px" style="color:#FFF; padding:5px; background-color:#06C; border: #CCC 1px solid;">Posted! Tell your friends!</div>';
// THE BELOW 3 LINES HAS THE PROBLEM
document.getElementById('quote_feed').innerHTML=http.responseText;
http.open("GET", "quote_feed.php", true);
http.send(null);
}
}
function insertReply() {
if(http.readyState == 4){
var response = http.responseText;
// else if login is ok show a message: "Site added+ site URL".
document.getElementById('insert_response').innerHTML = '<div width="400px" style="color:#FFF; padding:5px; background-color:#06C; border: #CCC 1px solid;">Posted! Tell your friends!</div>';
// THE BELOW 3 LINES HAS THE PROBLEM
document.getElementById('quote_feed').innerHTML=http.responseText;
http.open("GET", "quote_feed.php", true);
http.send(null);
}
}