The AJAX call gives the opportunity to handle the error case conveniently.  In the case of this AJAX call it seems to be important to catch the error to remove the spinning indicator that gives the user the impression that something is in progress,