Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Thinkphp+Ajax to realize the function of searching list with keywords without refreshing paging

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how to use Thinkphp+Ajax to achieve the search list with keywords without refresh paging function", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use Thinkphp+Ajax to achieve search list with keywords without refresh paging function" bar!

Thinkphp+Ajax search list with keywords no refresh paging instance, two query conditions, paging and search keywords, friends who understand can also add other paging parameters.

Search for # keyword and load content area # ajax_lists

Var url_ajax = "_ _ APP__/Box/orders"; $(function () {$("# ajax_lists"). Delegate (".pager a", "click", function () {var page = $(this) .attr ("data-page"); / / get the current click paging getPage (page);}) getPage (1) / / initialize paging}) function getPage (page) {$("# ajax_lists") .html ("list"); var keyword = $("# keyword") .val (); $.get (url_ajax, {keyword: keyword, p: page}, function (data) {$('# ajax_lists') .html (data);})})}

Remote ajax load list data

Public function orders () {$sql = "1cm 1"; $keyword = trim (I ('get.keyword')); if (! empty ($keyword)) {$sql. = "AND name like'%". $keyword. "%'";} $count = M ('js')-> where ($sql)-> count (); / / calculate the total $Page = new\ Think\ PageAjax ($count, 10); / / $lists = M (' js')-> where ($sql)-> limit ($Page- > firstRow. ','. $Page- > listRows)-> order ('id DESC')-> select (); $this- > assign ("page", $Page- > show ()); $this- > assign ("lists", $lists); $this- > assign ("keyword", $keyword); $this- > display () } Thank you for your reading, the above is the content of "how to use Thinkphp+Ajax to achieve the function of search list with keywords without refresh paging". After the study of this article, I believe you have a deeper understanding of how to use Thinkphp+Ajax to achieve the function of search list with keywords without refresh paging, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

  • Word Export html to realize online Preview

    The required maven dependencies are compiled and must be consistent with the version:

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report