<select id="direct">
<option value="">- выберите направление -</option>
<?php if (is_array($directions)): ?>
<?php foreach ($directions as $direction): ?>
<option value="<?=$direction['ID']?>">
<?php echo $direction['NAME']; ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>
<select id="modules">
<option value="">- выберите модуль -</option>
</select>
$(document).on('change','#direct',function(){
$.getJSON("task/ajax", {id:1}, function (data) {
$.each(res, function (index, item) {
$("#modules").append('<option value ="'+item.ID+'">'+item.NAME+'</option>');
});
});
});
function actionAjax(){
$action = 'S';
$params['GR'] = $_REQUEST['id'];
$table = 'MODULE';
$token = $_SESSION['token'];
$params = json_encode($params, JSON_UNESCAPED_UNICODE);
$res = GroupCL::getGroups($action, $table, $token, $params);
ob_clean();
echo json_encode($res);
die();
}
<script src="/template/assets/js/jquery-2.1.4.min.js"></script>
<script src="/template/assets/js/jquery.app.js"></script>
header('Content-Description: File Transfer');
header("Cache-Control: public, must-revalidate"); // кешировать
header("Pragma: hack");
header("Content-Type: " . $mm_type);
header("Content-Length: " .(string)(filesize($myFile)) );
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Content-Disposition: attachment; filename="' . basename($url).'"');
header("Content-Transfer-Encoding: binary");
if (ob_get_level()) {
ob_end_clean();
}
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($myFile));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($myFile));
readfile($myFile);
exit;