
[英]How to pass request body data in type POST using Datatable for Serverside pagination using Javascript
[英]Datatable with ServerSide send Form Data but $_POST is empty
我已经使用ServerSide配置了一个DataTable。
$("#tablaProductos").DataTable({
"Processing": true,
"serverSide": true,
"ajax": {
"url": "ajax/datatable-productos.ajax.php",
"type": "POST"
} });
网络通讯显示:一般
Request URL: http://localhost/POS_TH/ajax/datatable-productos.ajax.php
Request Method: POST
Status Code: 200 OK
Remote Address: [::1]:80
Referrer Policy: no-referrer-when-downgrade
响应标题
Cache-Control: no-store, no-cache, must-revalidate
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 294
Content-Type: text/html; charset=UTF-8
Date: Fri, 22 Nov 2019 15:31:15 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive: timeout=5, max=83
Pragma: no-cache
Server: Apache/2.4.34 (Ubuntu)
Vary: Accept-Encoding
请求标题
Accept: application/json, text/javascript, /; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: es-ES,es;q=0.9,en;q=0.8,ca;q=0.7
Connection: keep-alive
Content-Length: 1569
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: P...
Host: localhost
Origin: http://localhost
Referer: http://localhost/POS_TH/productos
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
X-Requested-With: XMLHttpRequest
表格数据
draw: 1
columns[0][data]: 0
columns[0][name]:
columns[0][searchable]: true
columns[0][orderable]: true
columns[0][search][value]:
columns[0][search][regex]: false
columns[1][data]: 1
columns[1][name]:
columns[1][searchable]: true
...
search[regex]: false
datatable-productos.ajax.php中的var_dump($_POST);
是: var_dump($_POST);
响应为: array(0) { }
我已经在数据表配置和var_dump(file_get_contents("php://input"))
尝试了"contentType": "application/json"
,但没有任何变化。
如果我通过GET更改了ajax类型并读取了$ _GET,我将发送所有参数(绘制,...),为什么? 如何使用POST类型?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.