Home  >  Article  >  Backend Development  >  smarty模板和php之间数据传递有关问题

smarty模板和php之间数据传递有关问题

WBOY
WBOYOriginal
2016-06-13 12:45:46776browse

smarty模板和php之间数据传递问题
本人做了一个页面,用的smarty模板。数据都在index.php中读出来了,然后显示在index.tpl文件中。但是tpl文件有个按钮,是要把数据按规定排序的。例如,我默认的是index.php中从数据库中读出来顺序是1,2,3,4。那么tpl文件中有个按钮,点击之后页面显示的就是4,3,2,1。目前就是想知道,怎么把那个点击事件传送到index.php,然后index.php按规定读出数据之后,再显示到tpl文件中。
我在tpl文件中写了一个点击事件,想用ajax传递,抓包显示的,index.php也读出了数据,但是当前tpl文件显示的还是之前的。

$("#sortbypop").click(function(){
var url = document.URL;
$.get(url,{action:"get",sort:"popsort"},function(data,textStatus){
});
});
这是那段ajax代码。请问要该怎么做?

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