Раньше не когда не работал с ajax, уже пару дней не могу решить проблему. Как Передать из php json в ajax.
<?php
include 'requests_json_wg.php';
include 'EFF.php';
include 'TIER.php';
require_once( "class_wn8.php" );
$data_user_clan = array();
$ratings_accounts = ratings_accounts(implode (",",$clan_user_id), $ApplicationID);
foreach ($clans_info['data'][$clans_list['data'][0]['clan_id']]['members'] as $key => $value)
{
$data_user_clan[$value['account_id']]['account_name'] = $value['account_name'];
$data_user_clan[$value['account_id']]['role_i18n'] = $value['role_i18n'];
$data_user_clan[$value['account_id']]['global_rating'] = $ratings_accounts['data'][$value['account_id']]['global_rating']['value'];
$data_user_clan[$value['account_id']]['battles_count'] = $ratings_accounts['data'][$value['account_id']]['battles_count']['value'];
$data_user_clan[$value['account_id']]['wins_ratio'] = $ratings_accounts['data'][$value['account_id']]['wins_ratio']['value'];
$data_user_clan[$value['account_id']]['tier'] = TIER($value['account_id'], $ApplicationID);
$data_user_clan[$value['account_id']]['rff'] = EFF($value['account_id'], $ApplicationID, $data_user_clan[$value['account_id']][5]);
$wn8 = new wn8($value['account_id'], $ApplicationID);
$data_user_clan[$value['account_id']]['wn8'] = $wn8->wn8_account();
break;
}
json_encode($data_user_clan));
?>
Понял что должна быть похожая конструкция ajax, но что делать дальше так и не разобрался.
<div class="test" id="test"></div>
$.ajax({
url: "test2.php",
type: "POST",
dataType: 'json',
success: function (res) {
$("#test").html(res);
}
});