i am having problem filling a selection box with json data. here my php code
<script src="jquery.js"></script>
<script src="jquery.jCombo.js"></script>
<style type="text/css">
</style>
<?php
$directory = opendir("C:/xampp/htdocs/xml");
$storeFilesIntoArray[] = "please select XML to load";
while (($fileName = readdir($directory)) !== false)
{
$getLastFourDigitsOfFile = substr($fileName,-4);
if($getLastFourDigitsOfFile == ".xml")
{
#echo "filename is " . $fileName . "<br/>";
$storeFilesIntoArray[] = $fileName;
}
}
$json = json_encode($storeFilesIntoArray);
echo $json;
closedir($directory);
?>
</script>
which give me this when i load that page on to a webpage
["please select XML to load","cd_catalog.xml"]
but i cant give to fill a dropbox with the data above because unsure how to use the json call to fill a selection box; here my code for the json call back function so far;
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: "dropdown.php",
data: data_str,
type:POST,
dataType: 'json',
success: function(d)
{
alert();
}
});
<body>
<select name="list1" id="list1"></select><br><br>
</body>