Refactor add details to use AJAX.