Click here to Skip to main content
16,016,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

PHP
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:

PHP
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);
	}
Posted
Updated 10-Feb-21 5:24am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900