我有这个错误:参数计数不匹配!我尝试了所有的语法,没有运气找到解决方案!
请帮忙!即时通讯使用ASP.net
我的javascript代码
(function (window, document, $, undefined) {
// $.fn.dataTable.ext.errMode = 'throw';
$(function () {
$('#datatable4').DataTable({
'Workflowing': true,
"responsive": true,
// 'serverSide': true,
ajax: {
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebPortal.asmx/GetTasksByUser?UserID=3&par=1",
"dataType": "json",
async: false,
data: JSON.stringify('{ UserID: "3"}'),
//data: function ( d ) {
// d.UserID = '3'
//},
dataSrc: function (json) {
return JSON.parse(json.d)
}
"columns": [
...My columns... ]
});
});
})(window, document, window.jQuery);
我错过了什么吗?!
答案 0 :(得分:0)
试试这样:
(function (window, document, $, undefined) {
// $.fn.dataTable.ext.errMode = 'throw';
$(function () {
mydata= {
UserID: "3"
}
$('#datatable4').DataTable({
'Workflowing': true,
"responsive": true,
// 'serverSide': true,
$.ajax: {
type: "POST",
contentType: "application/json; charset=utf-8",
url: "WebPortal.asmx/GetTasksByUser?UserID=3&par=1",
dataType: "json",
async: false,
data: JSON.stringify(mydata),
//data: function ( d ) {
// d.UserID = '3'
//},
dataSrc: function (json) {
return JSON.parse(json.d)
}
"columns": [
...My columns... ]
});
});
})(window, document, window.jQuery);