Im making a website for school and I needed a dynamic dropdown. I went about making it using this tutorial tutorial.
I have finished the first 6 parts and everything worked. In the last part when the first dropdown should appear it just doesn't. If the question is hard to answer or could have more answers just tell me what comes to mind and ill check. Ty in advance.
<html>
<head>
<title>askldfjdasklf</title>
<meta charset="UTF-8">
<meta name "viewport" content="width=device-width">
</head>
<body>
<label>Starost</label>
<select id="starost"></select><br>
<label>Praznuje</label>
<select id="praznuje"></select><br>
<script src="jquery-3.1.0.min.js"></script>
<script src="script.js"></script>
</body>
<pre>$(document).ready(function ()
{
$.getJSON("get_starost.php", success = function(data)
{
var options = "";
for (var i 0; i < data.length; i++)
{
options += "<option value='" + data[i].toLowerCase() + "'>" + data[i] + "</option>";
}
$("#starost").append(options);
});
});
</pre>
<pre>
<?php
require "opendb.php";
$query = "SELECT starost FROM filter_starost";
$data = mysql_query($query, $conn);
$starost = array();
while ($row = mysql_fetch_array($data))
{
array_push($starost, $row["starost"]);
}
echo json_encode($starost);
require "closedb.php";
?>
</pre>