Created
July 13, 2013 16:09
-
-
Save pr4v33n/5991191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//stateChangeHandler will fire when the state has changed, i.e. data is received back | |
// This is non-blocking (asynchronous) | |
function stateChangeHandler() { | |
//readyState of 4 or 'complete' represents that data has been returned | |
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') { | |
//Gather the results from the callback | |
var str = xmlHttp.responseText; | |
if (str != "") { | |
//document.getElementById('msgPanel').innerHTML += str; | |
var msgs = str.split('#'); | |
for (ind = 0; ind < msgs.length; ind++) { | |
msgs[ind] = msgs[ind].replace("_@HASH__", "#"); | |
var msg = msgs[ind].split("&"); | |
msg[0] = msg[0].replace("_@AMP__", "&"); | |
msg[1] = msg[1].replace("_@AMP__", "&"); | |
msg[2] = msg[2].replace("_@AMP__", "&"); | |
document.getElementById('msgPanel').innerHTML += "<br><b>" + msg[0] + ": </b>" + msg[2]; | |
// Change here | |
var msgPanel = document.getElementById("msgPanel"); | |
msgPanel.scrollTop = msgPanel.scrollHeight; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment