Home  >  Article  >  Backend Development  >  Detailed explanation of the operation of volist tag in thinkphp in ajax

Detailed explanation of the operation of volist tag in thinkphp in ajax

小云云
小云云Original
2018-01-16 13:53:501904browse

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

Background

Implementing the volist tag in a complex ThinkPHP page (including volist) to display the return of Jquery query results

Knowledge points

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

Solutions found so far (all have flaws)

1. Create a new page for display

Reopen a jump page and use $this- for the returned value >assign("volist_name", $data); is returned.

**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