implemented AJAX error handler when returning to index.html