Monday, June 30, 2008

Pass data structure from PHP to JS

In JS:


var ap_radioMode = unserialize('<?php echo serialize ($ap_radioMode) ?>');

i.e. Use PHP's serialze() and echo out the value, then apply JS's counterpart unserialize() to get the data structure.

No comments: