html head script type text javascript src jquery js script script func

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
<script type="text/javascript" src="jquery.js">
</script>
<script>
function get_clients() {
var url = "Ajax.do";
var ac = $("#test1 option:selected").val();
$.ajax(
{
type: 'POST',
url: url,
data: {ac: ac},
success: function(data) {
var myArray = data.split(";")
for(i=0; i<myArray.length; i++) {
$("#test2").append("<option id="+myArray[i]+">"+myArray[i]+"</option>")
}
}
})
return false;
}
</script>
</head>
<body>
<select id="test1" onchange="return ajax_change()">
<option value="1">First Option</option>
<option value="2">Second Option</option>
<option value="3">Third Option</option>
</select>
<select id="test2">
</select>
</body>
</html