diff --git a/static/js/helpers.js b/static/js/helpers.js index d22844c..e107a7f 100644 --- a/static/js/helpers.js +++ b/static/js/helpers.js @@ -77,14 +77,12 @@ function stream_ajax(path, callback, successCallback, failCallback, data) { req.onreadystatechange = function() { if(req.readyState > 2) { - var newData = req.responseText.substr(req.seenBytes); - - buffer += newData; + buffer += req.responseText.substr(req.seenBytes); var pointer; - while ((pointer = newData.indexOf("\n")) >= 0) { - var line = newData.substring(0, pointer).trim(); - newData = newData.substring(pointer + 1); + while ((pointer = buffer.indexOf("\n")) >= 0) { + var line = buffer.substring(0, pointer).trim(); + buffer = buffer.substring(pointer + 1); if (line.length === 0) { continue;