Smarty problems with data transfer between templates and PHP

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.