Banner image

Passing an array to js from PHP

This code line can be inserted at the top of a view file. It will add a document.ready function() js code line that creates a javascript array and passes it into a javascript function.
The data passed is only an example of how to pass data this way.

$this->addReadyCode("params={uid:'2',timestamp:'43543224333',url: '/home' };setLogin(params);");

Use in document.ready setJSxx() functions

This method is more secure than leaving information in visible DOM elements for js to pick up
iBiscuits LOGO

380 memberDB.php INSERT INTO et_page_visits ( vuid,vpage,vreferrer,vtime,vlang,vagent,vbot,vversion,vguest,vip) VALUES ( "1","","Unknown","1534483949","","CCBot/2.0 (","","biscuits-12y","","") ON DUPLICATE KEY UPDATE vuid = "1" ,vpage = "" ,vreferrer = "Unknown" ,vtime = "1534483949" ,vlang = "" ,vagent = "CCBot/2.0 (" ,vbot = "" ,vversion = "biscuits-12y" ,vguest = "" ,vip = ""
538 engine.php getContent help