Paging problem about trigger request problem

  1. I have been doing a paging these two days, and the paging effect has been done, but there is a small problem when getting the data. I hope you can help solve
.

2.1 first go to this page and get the housing pagination of all the areas. only 3 pages are right, and there is no problem on the previous page and the next page

.

2.2
2 .

    Mar.18,2021

    can you go up the paging code, so you can't see it?


    Don't sink.


    should it be two requests, or should it be two requests, or one more time


    ?

    I didn't look at the code carefully, but I judged that the problem occurred on your paging (next page, previous page) tag binding, or logically.
    this kind of paging code is supposed to return only the current page data and the total page number information, the current page information on the server side.
    you track the process of your request.
    in fact, there is no difference between getting the area and getting the whole, just a few conditional switches.

    < hr >

    in fact, the reason why the landlord made a mistake is that the data and view are so deeply coupled that the logic of the whole process is not clear.
    if I design a similar application, it looks like this

    1. the data is provided by the server, and the returned information includes information about Filter conditions and specific data
    2. data is received (feedback) by a set of status parameters. Filter status
    3. when requesting data from the server, the Filter condition is always set according to the status parameters
    4. after data acquisition, update the status parameters and update the view according to the data information
    5. Page switching processing triggers uniformly
    < hr >

    the corresponding pseudocode representation (note that there is only one such processing, and the rest is encapsulated in the getData function and the success method. )

    dataConfig={ // 
    ... 
    }
    ...
    $.ajax{
         url:""
         type:"post",
         data: getData(),// getData dataConfig
         dataType:"json",
         success:function(serverData){
             // serverData 
             // serverData
         }
     }
    Menu