Adds client-side validation and handling of AJAX success and failure