ajax 未在 php 文件中检索到数据参数

ajax data parameter not retrieved in php file

我是一名 JAVA 开发人员,正在尝试 php。我试图在 php 文件中检索 currMonth 的值,作为 .js 文件中的参数传递。我的日志打印了除我需要的以外的所有内容

(function($){
$(document).ready(function() {

var date= new Date();
var currMonth= date.getMonth();
//alert("Month!!:"+currMonth+1);
var editor = new $.fn.dataTable.Editor( {
    "ajax": "php/table.JKBINSR.php",
    "table": "#reminder",
    "data": {
    "currMonth": currMonth
     },
     ......

我的 php 文件看起来像这样

<?php

    //echo "Sorry you can't access this page directly";   

openlog("myapp", LOG_NDELAY, LOG_LOCAL2);
//syslog(LOG_ERR, {$_POST});
syslog(LOG_ERR, $_POST['currMonth']);
syslog(LOG_ERR, "JAVA ROCKS");
syslog(LOG_ERR, "php sucks");
closelog();
// DataTables PHP library
include( "lib/DataTables.php" );
.......

我的日志看起来像这样

Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: 
Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: JAVA ROCKS
Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: php sucks
Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: 
Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: JAVA ROCKS
Feb 10 12:08:25 Wasims-MacBook-Pro.local myapp[1045]: php sucks

我不知道

"ajax": "php/table.JKBINSR.php",
"table": "#reminder",
"data": {
"currMonth": currMonth
 },...

如果您设置方法 POST 尝试更改以测试是否是这个问题

syslog(LOG_ERR, $_REQUEST['currMonth']);