I am using datatables plugin for jquery and I am using the fnServerParams function.I have sent some extra variables but I am not sure how to retrieve them ont he server_processing file.
我正在使用jquery的datatables插件,我正在使用fnServerParams函数。我已经发送了一些额外的变量,但我不知道如何在server_processing文件上检索它们。
code :
代码:
$('#fleetsTable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/server_processing.php",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "customerId", "value": "6" } );
}
} );
this is what I have tried in the server_processing.php file
这是我在server_processing.php文件中尝试过的
$customerId = "";
if ( isset( $_GET['customerId'] ) )
{
$customerId = $_GET['customerId'] ;
}
this does not seem to be working..
这似乎没有工作..
thaks for the help
渴望得到帮助
1 个解决方案
#1
0
Andre's comment is wrong. Datatables requires you to send parameters in the format of
安德烈的评论是错误的。数据表要求您以格式发送参数
aoData.push( { "name": "customerId", "value": "6" } );
This would generate a URL of:
这将生成以下URL:
../server_processing.php?customerId=6
in your server code,
在您的服务器代码中,
$customerId = $_GET['customerId'] ;
should return the value. You'll need more debugging in your php file to determine where the variable is getting lost. Most likely a spelling mistake.
应该返回值。您需要在php文件中进行更多调试,以确定变量丢失的位置。很可能是拼写错误。
#1
0
Andre's comment is wrong. Datatables requires you to send parameters in the format of
安德烈的评论是错误的。数据表要求您以格式发送参数
aoData.push( { "name": "customerId", "value": "6" } );
This would generate a URL of:
这将生成以下URL:
../server_processing.php?customerId=6
in your server code,
在您的服务器代码中,
$customerId = $_GET['customerId'] ;
should return the value. You'll need more debugging in your php file to determine where the variable is getting lost. Most likely a spelling mistake.
应该返回值。您需要在php文件中进行更多调试,以确定变量丢失的位置。很可能是拼写错误。