Csharp:jquery.ajax-combobox
程序员文章站
2022-06-11 17:47:03
jquery.ajax-combobox JS object instead of DB: jquery.ajax-combobox Nation: ......
<%@ page language="c#" autoeventwireup="true" codebehind="webform3.aspx.cs" inherits="comboboxdemo.webform3" %>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>jquery.ajax-combobox</title>
<meta name="author" content="geovin du 涂聚文" />
<link rel="stylesheet" href="js/jquery.ajax-combobox.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.ajax-combobox.min.js"></script>
<script type="text/javascript">
var data;
$.getjson( "ajaxcomboxhandler.ashx", function( data ) {
/*
https://github.com/sutara79/jquery.ajax-combobox
https://plugins.jquery.com/ajax-combobox/
https://sutara79-php.herokuapp.com/demo/jquery.ajax-combobox/
var items = [];
$.each( data, function( key, val ) {
items.push( "<li id='" + key + "'>" + data[0].countycode + "</li>" );
});
$( "<ul/>", {
"class": "my-new-list",
html: items.join( "" )
}).appendto( "body" );
*/
$('#foo').ajaxcombobox(
data,
{
sub_info: true,
sub_as: {
countycode: '國際區號',
enname: '英文名',
position: '所在洲'
},
select_only: true,
init_record: '86',
primary_key: 'countycode',
}
);
});
//后台或者数据源
/*=<%=data%>
$.get("ajaxcomboxhandler.ashx", function(str) {
var arr = eval(str);
//alert(arr[0].countycode);
data = arr;
//alert(data[0].countycode);
});
*/
/*
$(function() {
$('#foo').ajaxcombobox(
data,
{
sub_info: true,
sub_as: {
countycode: '國際區號',
enname: '英文名',
position: '所在洲'
},
select_only: true,
init_record: '86',
primary_key: 'countycode',
}
);
});*/
</script>
</head>
<body>
<h1>js object instead of db: jquery.ajax-combobox</h1>
<form id="form1" action="" runat="server">
<label for="foo">nation:</label><br>
<asp:textbox id="foo" cssclass="foo" runat="server"></asp:textbox>
<asp:button id="button1" runat="server" text="button" onclick="button1_click" />
</form>
</body>
</html>
下一篇: 如何煮豆浆,喝豆浆有禁忌嘛
推荐阅读
-
.NETCore CSharp 中级篇2-3 Linq简介
-
C#语法糖(Csharp Syntactic sugar)大汇总
-
.NET Core CSharp 中级篇2-8 特性标签
-
CSharp初级篇 1-4 this、索引器、静态、常量以及只读
-
.NET Core CSharp初级篇 1-1
-
.NET Core CSharp 中级篇 2-2 List,ArrayList和Dictionary
-
Mongodb在CSharp里实现Aggregate实例
-
Csharp:jquery.ajax-combobox
-
Csharp:HttpWebRequest
-
.NETCore CSharp 中级篇2-3 Linq简介