Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Promoted
how to get php array to javascript function?
I need to do this in my webpage:
THE JS
function jsfunction(array){
var arraySize = array.length;
}
IN THE HTML
onclick="jsfunction(<?php echo $array; ?>)"
1 Answer
Relevance
- RatchetrLv 78 years agoFavorite Answer
This should do it, at least for simple cases:
onclick="jsfunction(<?php echo json_encode($array); ?>)"
Source(s): http://www.php.net/json_encode
Still have questions? Get your answers by asking now.