UI:
async function getSpecialties(){
let res = await fetch ('http://server-npk-web-core/specialties');
let specialties = await res.json();
})
}
async function getSubjectsSpecial(){
let res = await fetch ('http://server-npk-web-core/specialties');
let subjectsSpecial = await res.json();
})
}
BLL:
if($method === 'GET'){
if($type === 'subjects'){
getSubjects($pdo);
} elseif($type === 'specialties'){
getSpecialties($pdo);
getSubjectsSpecial($pdo);
}
function getSpecialties($pdo){
$specialties = 'SELECT * FROM `specialties`';
$stmt = $pdo -> query($specialties);
while ($special = $stmt->fetch()){
$specialtiesList[] = $special;
}
echo json_encode($specialtiesList);
}
function getSubjectsSpecial($pdo){
$subjectsSpecial = 'SELECT `subjects`.`title` FROM `subjects` WHERE `id_specialties` = 2';
$stmt = $pdo -> query($subjectsSpecial);
while ($subjectSpecial = $stmt->fetch()){
$subjectsSpecialList[] = $subjectSpecial;
}
echo json_encode($subjectsSpecialList);
}
Как их обработать так, что бы я мог использовать данные обоих запросов?
P.S. Не бейте палками, я только учусь(студент) -_-