我有一个ajax帖子,在执行时会返回一个重装页面。
Javascript:
function backOneSection() {
var current_question = <?php echo $current_question; ?>;
$.post("controller/get_section_back.php", { current : current_question }).done(function() {
$('#checkAnswers').modal('hide');
location.reload(true);
});
}
get_section_back.php
<?php
//Check below...vv
?>
有关信息,它可以在我的测试服务器上使用xampp。但是当我在主机服务器上运行它时,它给了我500内部服务器错误。 请提供解决方案,谢谢
我已编辑控制器以显示错误消息
<?php
/**
* Created by IntelliJ IDEA.
* User: DELL
* Date: 9/10/2014
* Time: 6:02 PM
*/
session_start();
include("../lib/meekrodb.2.2.class.php");
$current = $_POST['current'];
$get_sections = DB::query("SELECT DISTINCT(survey_type) FROM fo3_survey_questions");
$i=0;
$sections=[];
foreach($get_sections as $gs)
{
$i++;
$sections[$i]=$gs;
}
$get_current_type = DB::queryFirstRow("SELECT survey_type FROM fo3_survey_questions WHERE id_survey_question='$current'");
$current_section = array_search($get_current_type,$sections);
$current_section_type = $sections[$current_section]['survey_type'];
$get_section_ids = DB::query("SELECT id_survey_question FROM fo3_survey_questions WHERE survey_type='$current_section_type'");
$section_ids = [];
foreach($get_section_ids as $ids)
{
$section_ids[]=$ids['id_survey_question'];
}
$section_id = join(',',$section_ids);
//$delete_this_section = DB::query("DELETE FROM fo3_survey_answers WHERE id_survey_question IN (".$section_id.")");
ini_set("display_errors", 1);
echo error_reporting(E_ALL);
?>
和js一样
function backOneSection() {
var current_question = <?php echo $current_question; ?>;
$.post("controller/get_section_back.php", { current : current_question }).done(function(data) {
console.log(data);
//$('#checkAnswers').modal('hide');
//location.reload(true);
});
}
但它仍然没有显示错误消息,只是500内部服务器错误......