我使用无脂肪的 PHP 框架。
PHP:
F3::route('POST /vote', function(){
global $twig;
if(isset($_GET['studentKey'])){
$studentKey = $_GET['studentKey'];
//выборка id студента
$SELECT_student_Id = "SELECT id FROM identification WHERE studentKey = '$studentKey'";
DB::sql($SELECT_student_Id);
$studentId = F3::get('DB->result');
//выборка id преподавателя
$SELECT_teacher_Id = "SELECT idPrep FROM kbinding WHERE idStudent =". $studentId[0]['id'];
DB::sql($SELECT_teacher_Id);
$teacherId = F3::get('DB->result');
echo $twig->render('vote.html', array('ids' => $studentId[0]['id'],
'teacherId' => $teacherId[0]['idPrep']));
}else{
echo $twig->render('404.html', array('error' => 'Ошибка'));
}
});
JavaScript:
$(document).ready(function(){
$('#sendData').click(function(){
$.ajax({type: "POST", url: "engine.php", data: some_data,
success:function(){
***location.reload();***
},
error: function(){
alert("Error");
}
});
});
});
而且我无法刷新页面,因为它是一种发布方法。如何使用 Post 方法并毫无问题地刷新此页面?