我想使用modal添加记录,但似乎我无法从ajax请求中获取值,
(home.php)
<?php
require_once("class.user.php");
$auth_user = new USER();
//add row
$page = isset($_GET['p'])?$_GET['p']:'';
if($page=='add'){
$modsubj = $_POST['subj'];
$modsect = $_POST['sect'];
$modstart = $_POST['start'];
$modend = $_POST['end'];
$modday = $_POST['day'];
$user_id = $_POST['user'];
$auth_user->createSchedule($subj,$sect,$day,$strTime,$endTime,$user_id);
$schedRow = $auth_user->readSchedule();
}
else if ($page == 'edit') {}
?>
(modal.funcs.php)我认为问题是变量Content-Type
没有取GET值
Content-type
答案 0 :(得分:0)
尝试改变
data: "subj="+modsubj+"§="+modsect+"&start="+modstart+"&end="+modend+"&day="+modday,
到
data: {"subj="+modsubj+"§="+modsect+"&start="+modstart+"&end="+modend+"&day="+modday},