added error function to ajax call