日期:2014-05-17 浏览次数:20903 次
<script type="text/javascript">
$(function () {
$("#username").blur(function () {
var username = document.getElementById('username').value;
$.ajax({
//要用post方式
type: "Post",
//方法所在页面和方法名
url: "Login.aspx/Ziwu",
data: "{'Username':'" + username + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var distValue = data.d;
var distQL = distValue.split('~');
for (var i = 0; i < distQL.length; i++) {
var subItem = new Array();
subItem = distQL[i].split("?");
var text = subItem[1];
var value = subItem[0];
document.getElementById('DropDownList1').add(new Option(text, value)); //绑定DropDownList的value值,text值
}
//返回的数据用data.d获取内容
//alert(str);
},