1
添加引用
using MyBookShop.BLL;
using MyBookShop.Models;
2
摘要说明[]后,添加:
[System.Web.Script.Services.ScriptService()]
3
修改[WebMethod]下的方法:
//搜索图书的方法:
public string[] GetHotSearchByKeywords(string prefixText, int count)
{
//根据关键字和显示行数,返回查询的结果
return SearchKeywordManager.GetHotSearchKeywords(prefixText, count);
}
添加引用
using MyBookShop.BLL;
using MyBookShop.Models;
2
摘要说明[]后,添加:
[System.Web.Script.Services.ScriptService()]
3
修改[WebMethod]下的方法:
//搜索图书的方法:
public string[] GetHotSearchByKeywords(string prefixText, int count)
{
//根据关键字和显示行数,返回查询的结果
return SearchKeywordManager.GetHotSearchKeywords(prefixText, count);
}
本文介绍了一个基于ASP.NET AJAX的图书搜索服务实现方法。通过添加必要的引用,并使用ScriptService特性,使服务能够被AJAX调用。文章详细展示了如何创建一个返回热门搜索关键词的方法,该方法接收关键字前缀和返回数量作为参数。

197

被折叠的 条评论
为什么被折叠?



