prestashop_newuser Posted April 15, 2016 Share Posted April 15, 2016 I am creating a custom module. In that module I want to use my php variable inside the js file. How can I access the value in js file. I don't want to pass the variable to smarty file. The js file is hooked in the header. So can someone tell me how to pass the php value to external js file which is hooked in the header? Any help and suggestion will be really appreciable. Thanks Link to comment Share on other sites More sharing options...
Daresh Posted April 15, 2016 Share Posted April 15, 2016 Make the script call some PHP file by AJAX and get the value as a response. Link to comment Share on other sites More sharing options...
prestashop_newuser Posted April 15, 2016 Author Share Posted April 15, 2016 Make the script call some PHP file by AJAX and get the value as a response. I think passing the value from js to php is a good option in ajax. But here I want to access php value in js. For that what will be the good option? Link to comment Share on other sites More sharing options...
Daresh Posted April 15, 2016 Share Posted April 15, 2016 The only option is to display the value somewhere on the site, but passing it to smarty would be much better. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now