失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 基于jquery的文本框与autocomplete结合使用(asp.net+json)【jquery】

基于jquery的文本框与autocomplete结合使用(asp.net+json)【jquery】

时间:2022-11-22 10:29:19

相关推荐

基于jquery的文本框与autocomplete结合使用(asp.net+json)【jquery】

web前端|js教程

jquery,文本框,autocomplete

web前端-js教程

JS脚本引用

多线程 串口 源码,vscode格式化选定内容,ubuntu网卡加密,tomcat加入不了项目,爬虫哪里看,php 启动app,seo营销应该如何做排名lzw

样式引用

模拟考试系统 源码下载,ubuntu下载无法连接,简单爬虫编写方法,appsev php,seo渠道价格lzw

@import url("/scripts/Jquery.autocomplete/css/jquery.autocomplete.css");

JS代码

工具站源码,vscode -4058,ubuntu 更换源,linux重启tomcat,sqlite html,国内设计网页设计,mysql 数据库创建,买个论坛服务器,dz插件上传不显示,html5前端ui框架,爬虫群,阿里云 php,网络公司seo,内网springboot环境,织梦文章描述标签,phpcmsv9手机网站源码,html简单网页代码 登录,bootstrap 好友模板,ecshop修改后台名字,js页面验证提示,基于struts2报价管理系统代码下载,PT小说搜索程序lzw

?$(document).ready(function () {

$("#").autocomplete("./AjaxHandle/AutoComplete.ashx?type=game", {

minChars: 0,

max: 9,

width: 150,

matchContains: true,

autoFill: false,

formatItem: function (row, i, max) {

return row.name;

},

formatMatch: function (row, i, max) {

return row.name + " ";

},

formatResult: function (row) {

return row.name;

}

});

jQuery("#").result(function (event, data, formatted) {

if (data) {

jQuery("#_SearchKeyGame").attr("value", data.name);

}

else {

}

});

$("#").autocomplete("./AjaxHandle/AutoComplete.ashx?type=plat", {

minChars: 0,

max: 9,

width: 150,

matchContains: true,

autoFill: false,

formatItem: function (row, i, max) {

return row.name;

},

formatMatch: function (row, i, max) {

return row.name + " ";

},

formatResult: function (row) {

return row.name;

}

});

AutoComplete。ashx返回JOSON值

string queryStr = context.Request.QueryString["q"];

context.Response.ContentType = "text/plain";

context.Response.Cache.SetNoStore();

string jsponString = "[";

string where = string.Format(" (select dbo.[f_GetPy](platname)) like \%{0}% or platname like \%{0}%\", mon.ToSql(queryStr));

DataTable dt = new Models.Plat().GetDataTable(where,10);

if (dt.Rows.Count > 0)

{

for (int i = 0; i < dt.Rows.Count; i++)

{

jsponString += "{id:\"" + dt.Rows[i]["PlatID"].ToString() + "\",name:\"" + dt.Rows[i]["PlatName"].ToString() + "\"},";

}

}

jsponString = jsponString.Trim(new char[] { , });

jsponString += "]";

context.Response.Write(jsponString);

context.Response.End();

如果觉得《基于jquery的文本框与autocomplete结合使用(asp.net+json)【jquery】》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。