i'm doing this in codeigniter
here is my php switch - case part
case 'check':
$balance = $this->Model_transactions->getUserBalance($this->input->post('userId'));
$needToPay = floatval($this->input->post('tuitionRate')) / 2; // 50%
if ($balance >= $needToPay) {
$results = '{"Result": "OK";"Balance":'.$balance.'}';
}
break;
here is the json code
$.ajax({
url: base_url + "api/hires/check/?callback=?",
type: "POST",
dataType: "jsonp",
data: {
userId: $(".navigation").data("login"),
tuitionRate: t.find("#txt-hire-rate").val()
}
}).done(function (a) {
if (a) if ("OK" != a.Result) {
alert (a.Balance);
what i want is to use php $balance variable in my jQuery. please help.