我正在尝试将一些数据发布到将执行 mysql 插入的函数。没什么好看的。但我可以让事情正常工作,我的问题是我应该告诉 jQuery 发布到哪里,它会尊重 php 包含的内容吗?
这就是我所拥有的
include_once 'modules/interviews/helper.php';
if($link == 'my_interviews'){
include_once 'modules/interviews/my_interviews.php';
} elseif($link == 'interview_panel'){
include_once 'modules/interviews/interview_panel.php';
}
上面是我的index.php,在提交表单的页面加载
$('.addinote').click(function() {
var app = $(this).attr("data-app"),
user = $(this).attr("data-subi"),
txt = $('#' + app).val();
if(txt === ''){
alert('Whoops, did you enter something?');
}else{
var params = {};
params['user_id'] = user;
params['app_id'] = app;
params['inote'] = txt;
params['subinote'] = '1';
$.post('http://localhost/gem/modules/interviews/index.php', params,
function(data){
if(data){
}
else{
alert('Whoops, there was a problem, please try again!');
}
});
}
helper.php 包含这个...
if(isset($_POST['subinote'])){
$apply->inote();
}
并且该类包含这个....
function inote(){
$query = "INSERT INTO `app_notes` (`user_id`, `application_id`, `inote`)
VALUES ('{$_POST['user_id']}', '{$_POST['app_id']}',
'{$_POST['inote']}')";
$GLOBALS['DB']->insertQuery($query);
}
我应该在哪里发帖?