1.3.2 버전 jquery 로 구현시, GetJSON 함수 사용법이 다소 틀리다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<meta http-equiv="content-type" content="text/html; charset=euc-kr" />
<script type='text/javascript' src='_scripts/jquery-1.3.2.min.js'></script>
<script language="javascript">
function sendGetJSON(){
var params = { name : 1 }; //파라미터 선언
$.getJSON("LoadCities.asp", params, function (returnData, textStatus)
{
if(textStatus == 'success')
{
var cnt = returnData[0].item.length;
$("#ddlCities").html("");
for(var j=0; j < cnt ; j++)
{
$("#ddlCities").get(0).options[j] = new Option(returnData[0].item[j].text, returnData[0].item[j].value);
}
}
else
{
alert("ERROR!");
return;
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>State</td>
<td>
<select ID="ddlStates" onChange="sendGetJSON()">
<option selected="selected" value="WriteUserName">이름</option>
<option value="Title">제목</option>
<option value="MobileContent">내용</option>
<option value="WriteDate">날짜</option>
</select>
</td>
</tr>
<tr>
<td>Cities</td>
<td>
<select ID="ddlCities">
</select>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
asp..~~~~
<%@LANGUAGE="VBSCRIPT" CODEPAGE="949"%>
<% Response.CharSet = "euc-kr" %>
<%
response.write "[{""item"":[{""text"" : ""SampleProject"",""value"": 6}, {""text"": ""Ticket1s"",""value"":17}]}]"
%>