Dear Gurus,
I have Fee Record List of Students retrieved from database. I have a button name Pay, which is a Hyperlink, I want when the Link Pay is clicked, it submit a form which has to update the FeeReceipts table by setting paid from 0 to 1, and make the Red Color Link Pay to Paid in Green Color, and update the result on the same page.
In simple I want to know that how to execute the update function through JQuery and change button's text from Pay to Paid and also style color from Red to Green.
This is the Link's code in my View
if($row->paid==0){
$p = '<a href="'. base_url() .'/FeeReceipts/payfee/'.$row->receiptno.'" id="payfee" class= "btn btn-sm btn-danger">Pay</a>';
}
Please help, below is my update function:
What I have tried:
public function updatereceipt()
{
$model = new FeeReceiptModel();
$id = $this->request->getVar('id');
$data = ['additionalfee' => $this->request->getVar('additionalfee'),
'instantdisc' => $this->request->getVar('instantdisc'),
'remarks' => $this->request->getVar('remarks'),
'paidamount' => $this->request->getVar('paidamount'),
'paid'=>$this->request->getVar('paid')];
$model->update($id,$data);
}