You can convert php arrays into javascript using php’s json_encode()* function:
Example:
$php_array =>array( 'usd'=>500, 'sgd'=>500, 'cad'=>500, 'eur'=>200, 'cny'=>500 )
To use the array, remember do JSON.parse():
var js_array = <?php echo json_encode($php_array ); ?>; var newArray = JSON.parse(js_array);
To use the array, jquery $.each is easy to loop and retrieve the information:
var js_array = <?php echo json_encode($php_array ); ?>; $.each(js_array, function(currency, value) { //do your stuff here }
What do you think?