This fixes an issue where the AJAX URI could have invalid characters inserted.