I have POS system made in codigniter. I have three fields
- Cash Received
- Cash Pending
- Balance
I have payment edit form that open in a model and display values. I am getting values with these code
$.ajax({
  url: 'payment/editPaymentByJason?id=' + iid,
  method: 'GET',
  data: '',
  dataType: 'json',
}).success(function (response) {
  var cr = response.cash_received;        
  var cp = response.cash_pending;        
  var b = cr - cp;
but the output is not what i need. Let suppose
Cash Received = 500
Cash Pending = 200
Instead of showing 300 in the balance field This this function shows 500200 in the balance field.
I want to how i add or subtract value in var b ?
 
     
    