【问题标题】:use POST request in pagination.js在 pagination.js 中使用 POST 请求
【发布时间】:2021-04-01 07:41:17
【问题描述】:

我正在使用 Pagination.js。正常方式

dataSource: `/ajax/products`,
locator: 'items',
totalNumber: {{ $count }},
pageSize: 2,

我想使用发布请求。所以我尝试使用此代码

dataSource: `/ajax/products`,
type: 'post',
data: {
    'price' => 200
},

但它不起作用。它显示错误“Uncaught SyntaxError: missing : after property id”。我该如何解决我的问题?

【问题讨论】:

标签: javascript jquery pagination


【解决方案1】:

试试这个

dataSource: function () {
                $.ajax({
                    type: 'POST',
                    url: '/ajax/products',
                    data: { price: 200},
                    success: function (response) {
                    }
                });
            }

注意:pageNumber 和 pageSize 参数不会以正常方式将其获取到服务器端

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-20
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多