I'm getting this error Uncaught TypeError: Illegal invocation
I've tried to parse it
here's script
function Addpayment(or_number, customer_no) {
var or_number = $("#or_number").val(or_number);
var customer_no = $("#customer_no").val(customer_no);
$.ajax({
url:"<?php echo base_url('dashboard/addpaymenttable') ?>",
data:{ or_number:or_number,customer_no:customer_no},
type:"POST",
success: function(data){
// data = JSON.parse(data);
alert(data.or_no);
console.log(data);
}
});
}
AND heres my cotroller
// $result = $this->M_dashboard->GetPayment($customer_no,$or_no);
// echo $result;
And here's my model
$query = $this->db->select("*")->from("customer_payment")->where("or_no",$or_no)->where("customer_no",$customer_no)->get();
// $data =[];
foreach($query->result_array() as $row){
// print_r($row['or_no']);
$data = [
"or_no"=>$row['or_no'],
"customer_no"=>$row['customer_no'],
"date_of_transaction"=>$row['date_of_transaction'],
"payment_type"=>$row['payment_type'],
"payment_for"=>$row['payment_for'],
"price"=>$row['price'],
"process_by"=>$row['process_by'],
"status" =>$row['status'],
];
}
return json_encode($data);