The particularity of the volist tag in thinkphp in ajax operations

jacklove
Release: 2023-04-02 07:50:01
Original
2354 people have browsed it

Implement the volist tag to display the return of Jquery query results in a complex ThinkPHP page (including volist). This article introduces to you the particularity of the volist tag in thinkphp in ajax operations (recommended). Friends who need it can refer to it

Background

In a Implement the volist tag in ThinkPHP's complex page (including volist) to display the return of Jquery query results

Knowledge points

The purpose of using ajax is to not refresh the entire page Refresh some table data, but note that the volist tag in the ThinkPHP framework runs on the server side, so data dynamically obtained using js cannot use thinkPHP tags, and $this->ajaxReturn($data) cannot be used ; The result of is displayed directly using the method $("#p_id").HTML(data) .

Solutions found so far (all have flaws)

1. Create a new page for display

Reopen a jump page and you will be returned The value is returned in the form of $this->assign("volist_name", $data);.

**Defect: It is equivalent to reloading the entire page, and does not meet the requirement of partially updating the form.

2. Display without thinkPHP framework tags

Do not use volist tags, analyze the results returned by ajaxReturn, and display them according to your own js template, which can realize partial form updates

1,template<script id="events-template" type="x-tmpl-mustache"> {{#data}}

Summary

The above is the particularity of the volist tag in thinkphp in ajax operation introduced by the editor (recommended). I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank you all for your support of the php Chinese website!

Articles you may be interested in:

Detailed explanation of the volist tag in thinkphp

PHP implements knowledge related to finding the entry node of the ring in the linked list

PHP implements an image processing tool class that can add watermarks and generate thumbnails_php skills

The above is the detailed content of The particularity of the volist tag in thinkphp in ajax operations. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!