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);
}
どこに投稿すればいいですか?