Added fail handler for ajax