Fix bug of posting data via AJAX