Updated the AJAX script, but it needs finishing.