Variable from Javascript -> Php -> Smarty... is it possible? -



Variable from Javascript -> Php -> Smarty... is it possible? -

example:

<script type="text/javascript"> insertvideos({ 'block':'youtubediv', 'q':'keyword', 'type':'search', 'results':8, 'order':'most_relevance', 'player':'embed', 'layout':'thumbnails' }); </script>

i need 'results' variable pass, @ end of process need like: {if $results != 0} how can it?

there isn't way access php/smarty in javascript executed in 2 different worlds.

the page requested server. server executes php , generates content smarty. server sends resulting html , javascript source code client. server done. if request received, starts on anew without knowledge of previous request.

the client receives html , javascript source , displays. insertvideos method gets calls. @ point, has no interaction server , php/smarty features.

from there, javascript create ajax request server or if create assumption want display videos if search finds (results > 0), can create check in javascript , add/modify dom elements needed.

php javascript variables smarty

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -