在 pagination.js 中使用 POST 请求 [英] use POST request in pagination.js

查看:93
本文介绍了在 pagination.js 中使用 POST 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Pagination.js. In normal way

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

我想使用 post 请求.所以我尝试使用此代码

I want to use post request. So I tryed use this code

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

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

But it doesn't work. It display error "Uncaught SyntaxError: missing : after property id". How can I solve my problem?

推荐答案

试试这个

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

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

note : pageNumber and pageSize parameters not fetch it into server side by normal way

这篇关于在 pagination.js 中使用 POST 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆