added ajax call with error and loading animations