added .fail method to ajax call