Сообщение от lewa_yun
|
ну как то так, так вот главный вопрос как это передать яваскрипту
|
$res->field1 = 'foo';
$res->field2 = 'bar';
$arr = array();
while ($something) {
$arr[] = $somefunction();
}
$res->field3 = $arr;
echo json_encode($res);
$.ajax({
//...
success: function (res) {
console.log('res.field1 (string) = ' + res.field1);
console.log('res.field2 (string) = ' + res.field2);
console.log('res.field3 (array) = ' + res.field3);
}
});