Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to access javascript variable in php code? 
 
muk_t
Sr. Member
 
Total Posts:  226
Joined:  2012-07-24
 

Hi,

I want to access a javascript variable in php code.How can I do this please suggest me some way

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
crm4ecommerce
Jr. Member
 
Avatar
Total Posts:  24
Joined:  2011-11-01
 

Hi muk_t,

You can only generate javascript code or generate script tag to link a javascript file, url to your php file. Javascript is available on browser, but php code is runned on web server, so you can’t access javascript code by php code.

Regards,

Philip Nguyen

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rich Cleverley
Sr. Member
 
Avatar
Total Posts:  285
Joined:  2009-01-20
 

You would need to pass the variable through to PHP using an AJAX request.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top