php - link ajax response to smarty variables

907

I'm usingsmarty to separate the presentation from the business logic. I have a form which contains a select box , an input text field(text to search for) and a button (search). Wen I click on the button I want to show the contacts array from my database without reloading my page again. So that I thought to use Ajax. But when usingajax within smarty, I have had major headaches with it the last few days... Smarty is only used when the page is actually loading (or reloaded), but not when an ajax request withjQuery (or other js frameworks) is answered so that I can't use ajax to send smarty variable to my form. Is there any way to link smarty with ajax so that I can show the contacts array into an html table? Can you help me to find a way to show the list of my contacts after the searching on my page?

577

Answer

Solution:

Smarty is a php library and therefore cannot work on the client side.

If you want Smarty to parse some variables you will need to setup and parse a page before sending it as the response to the AJAX call and then have Javascript replace the html with the new code.

People are also looking for solutions to the problem: paypal/wepay delayed chained payment php

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.