Show error on ajax 500 and better chart switching