Banner image SITE-LANGUAGE-en-ICON BROWSER-LANGUAGE--IMAGE
Content / help / array2js .. concise-view << previous next >>

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