Twiebie |
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
I'm trying to get data into a TPL from a PHP file with AJAX. The code I currently have is as following: This is the JavaScript bit:
And test.ajax.php:
The TPL:
For some reason it just doesn't display what I assign to MAIN.TEST_ROW. When I do a simple echo for testing like shown below it does output the data in the TPL with AJAX.
Thanks. Added 1 hours later: Hmm, it sort of works when I add to the foreach loop both parse and out:
But I'm wondering if this is the correct way? Added 2 days later: Bump. |
|||||||||||
Отредактировано: Twiebie (03.10.2012 17:46, 12 лет назад) |
GHengeveld |
|
||||||
---|---|---|---|---|---|---|---|
Within the foreach, you need to do a parse('MAIN.TEST_ROW'), not an out(). At the end of your file, you need to do this:
Usually you use out() only once: for the MAIN block at the end of your php code. You can omit the 'MAIN' in out(), because it's the default value. To seperate your html code for a=update you may want to add the UPDATE block. Also, you'll often want to be able to show a message if there aren't any results:
A complete tpl could look like this:
|
|||||||
Отредактировано: GHengeveld (04.10.2012 07:37, 12 лет назад) |