Added some basic error handling to failed ajax calls