Smarty data transfer issues between templates and PHP
I made a page, using the Smarty template. The data is read in index.php and then displayed in the Index.tpl file. However, the TPL file has a button to sort the data as specified. For example, my default is that index.php is read from the database in the order of 1,2,3,4. Then there is a button in the TPL file, and the 4,3,2,1 is displayed on the following page. For now, I want to know how to transfer that click event to index.php and then index.php read the data as specified and then display it in the TPL file.
I wrote a click event in the TPL file, want to use Ajax to pass, capture the packet display, index.php also read out the data, but the current TPL file shows the previous.
$ ("#sortbypop"). Click (function () {
var url = document. URL;
$.get (url,{action: "Get", Sort: "Popsort"},function (data,textstatus) {
});
});
This is the AJAX code. What should I do?
Share to:
------Solution--------------------
If you want to use Ajax to do a partial refresh, then you have to take the template apart. That is, different requirements with different templates
If you want to refresh the whole, don't use Ajax