Home >Backend Development >PHP Tutorial >What are the precautions for using the volist tag in Ajax in thinkphp?
This time I will bring you what are the precautions when using the volist tag in thinkphp in ajax. The following is a practical case, let’s take a look.
Background
Implement the volist tag to display Jqueryquery results in a complex ThinkPHP page (including volist) Return
Knowledge points
The purpose of using ajax is to refresh some table data without refreshing the entire page, but pay attention to Think# The volist tag in ##PHP framework runs on the server side, so the data dynamically obtained using js cannot use the thinkPHP tag, and $this->ajaxReturn<a href="http://www.php.cn/wiki/135.html" target="_blank">( $data); The result of </a> is displayed directly using the method
$("#p_id").HTML(data) .
Solutions found so far (all have flaws)
1. Create a new page for displayReopen 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 tagsDo not use volist tags, analyze the results returned by ajaxReturn, and display them according to your own js template, which can realize partial form updates1,template template<script id="events-template" type="x-tmpl-mustache"> {{#data}}I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:
Detailed explanation of the steps to print a binary tree in Z-shaped order with PHP
How to make a watermark and generate abbreviation in PHP Sketch class
#PHP Detailed explanation of the steps to obtain the nodes of the linked list from back to front
The above is the detailed content of What are the precautions for using the volist tag in Ajax in thinkphp?. For more information, please follow other related articles on the PHP Chinese website!