我尝试将以下datatable
javascript从GET
转换为POST
方法。代码如下所示,
var pagination = new DatatablesPagination({
tableSelector: '.casesTable',
tableContainer: data.tableContainer,
onError: callbacks.onError,
iDisplayLength: recordsPerPage,
pages: 4,
sAjaxSource: ajaxSource,
fnServerParams: function(aoData) {
$.each(additionalQueryParams, function(index, additionalQueryParam) {
aoData.push(additionalQueryParam);
});
},
fnDrawCallback: function(settings) {
if (typeof callbacks !== "undefined" && typeof callbacks.onDrawOfAssociatedCases !== "undefined") {
callbacks.onDrawOfAssociatedCases(settings, reportHolder);
if ($("#associatedCasesTableWrapper").is(":visible")) {
updateLocation();
}
}
}
}):
我尝试添加sServerMethod:POST
,如下所示,但没有运气。
sServerMethod: 'POST',
sAjaxSource : ajaxSource,
fnServerParams : function ( aoData ) {
$.each(additionalQueryParams, function(index, additionalQueryParam) {
aoData.push( additionalQueryParam );
});
},
有人可以帮我将此方法从GET
转换为POST
吗?
答案 0 :(得分:0)
您的服务/服务器设置可能会使用GET
配置,但您正尝试使用来自ajax的POST
访问它。尝试将服务设置更改为POST
。
请参考,
POST 405 (Method not allowed) when trying to post AJAX request - Laravel 4