Added error function for handling Ajax call error