search
Homephp教程php手册一个简单的ajax

简单的ajax分页,不用去php改代码什么的,也不用改自带的分页类,只需要一段简单的js代码
只说思路,明白人一看就明白了。

前提在控制器里用tp的渲染模板函数:fetch();

第一 tp自带的分页 在页面上是不是有链接?直接用js获取分页下a标签的herf,然后用return false ;不让他跳转。

第二,(原生的js,自己想办法)jquery的ajax下 是不是有个参数是url?,然后把获取的a标签url,放进这个参数里。

后台代码$this->assign('invest', $查询的数据);<br> echo  $content=$this->fetch('ajax_xxx'); //渲染的html模板页面代码<!-- 分页 --><br> <div> <br>     {$_page}<br> </div> <br> <script><br /> //get条件查询<br /> $(&#039;.page div a&#039;).on(&#039;click&#039;, function() {<br /> var url = $(this).attr(&#039;href&#039;);<br /> $.get(url, function(data) {<br /> $(".xxxx").html(data);<br /> });<br /> return false;<br /> });<br /> </script>

AD:真正免费,域名+虚机+企业邮箱=0元

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),