Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty session array inside Javascript

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
rishee97
Smarty n00b


Joined: 10 Jul 2017
Posts: 1

PostPosted: Mon Jul 10, 2017 3:20 pm    Post subject: Smarty session array inside Javascript Reply with quote

PHP:
$t_ap=$quantity[$i]*$sp;
$_SESSION["t_ap"]=$t_ap;


The above code is php code for storing t_ap in session for using it in tpl file.
When in try print_r($_SESSION["t_ap"]); the output is 2000 4000 200.
But when i use it inside tpl file the output is only 200;

TPL:(inside javascript)
var arr1 = {$smarty.session.t_ap|json_encode};

When i print array the value is 200
All i want is to receive values of $t_ap in javascript and to create a table with it.
Please help me with this.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Jul 10, 2017 6:33 pm    Post subject: Reply with quote

Check the actual HTML (ok, JS) generated by your template.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP