Author Topic: Problem encountered using POST Parameters with Paging?  (Read 2479 times)

ronperkins

  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem encountered using POST Parameters with Paging?
« on: January 13, 2016, 03:55:25 am »
If I do not pass any POST parameters as shown in the code below:

    var dataModel_brands = {
            location: "remote",
            dataType: "JSON",
            method: "POST",
            url: "/test_ajax.php",
            getData: function (dataJSON) {
                var data = dataJSON.data;
                return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
            },
            sortIndx: ["name"]
        };


My Ajax class receives these POST parameters: pq_datatype=JSON&pq_curpage=1&pq_rpp=20

But if I pass my own POST parameters which are needed as shown in the code below:

     var dataModel_brands = {
            location: "remote",
            dataType: "JSON",
            method: "POST",
            getUrl: function() {
                return { url: "/test_ajax.php", data: {a : 'fetch_brands', usr : 'username'} };
            },
            getData: function (dataJSON) {
                var data = dataJSON.data;
                return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
            },
            sortIndx: ["name"]
        };


My Ajax class only receives these POST parameters: a=fetch_brands&usr=username

For some reason the parameters needed for paging are not appended ?

Have I done something wrong or have I found a bug?

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Problem encountered using POST Parameters with Paging?
« Reply #1 on: January 13, 2016, 09:31:45 am »
Any custom parameters should be added in dataModel.postData

http://paramquery.com/pro/api#option-dataModel-postData