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

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

actionscript 3 - Flex: moving a point with rotation doesnt change the point XY? -