added ajax request for error handling