You are sending it the POST key of “comment” in your Javascript, but in your PHP you are looking for “content”. Also, try using $this->input->post(‘comment’) instead of $_REQUEST as I think CI MIGHT kill that variable just like GET as its even more insecure.
You also are using $(this).html() which is incorrect, as you would be sending the inner HTML of the submit button they just clicked, which is clearly wrong. You want to send $(“input#comment_box”).text() or .html() instead.
There is no reason for your “e” parameter in the function call, and really you should do some checking in both JS and PHP to see if it worked. If the data is invalid then return a status header ( I use the following code to see if it worked or not, 404 is the wrong status but I dont know a better one).
function delete_payment($id = 0)
{
$this->load->helper('ajax');
if(isAjax()):
if($this->invoices_model->deleteInvoicePayment($id)):
$this->output->set_header('HTTP/1.1 200 OK'); // Worked fine
else:
$this->output->set_header('HTTP/1.1 404');
$this->output->set_output($this->lang->line('error_delete_payment'));
endif;
else:
if($this->invoices_model->deleteInvoicePayment($id))
// Redirect to good or bad page message, whatever
endif;
}
Then you can use jQuery’s second callback function, first is success, second is failure.