i have json installed on the server. you can convert a php to a javascript array string by using this:
PHP Code:
<?
$array = array('apple', 'orange', 'pear');
echo json_encode($array);
?>
then u can use some ajax stuff like this:
HTML Code:
<script>
// start ajax stuff
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(method, URL) {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open(method, URL, true);
xmlHttp.send(null);
}
function handleStateChange() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
processResponse(xmlHttp.responseText);
}
}
}
function processResponse(response) {
my_songs = eval(response);
}
// end ajax stuff
// initialize your song array
var my_songs;
// make ajax request
startRequest('GET', 'my_php_script.php');
// now my_songs is set to your php array
</script>