$(function(){ // Add a flash message var flash = function(category, message) { $('#flashes').append($('
Waiting for data to finish traversing Tor network ...');
}
}, false);
ajax.addEventListener('load', function(event){
// Remove the upload div
ajax.$upload_div.remove();
// Parse response
try {
var response = JSON.parse(ajax.response);
// The 'new_body' response replaces the whole HTML document and ends
if('new_body' in response) {
$('body').html(response['new_body']);
return;
}
// Show error flashes
if('error_flashes' in response) {
for(var i=0; i