.net网站如何用ajax读取sql数据,并在html中显示数据 不允许在.aspx文件里面写ajax。而是在html文件里面写ajax来读取数据库。求详细的代码。本人菜鸟,望给点详细的解释 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可以使用jquery嘛,或者自己写呀,看一下ajax的简单例子就会了 只能说这个很简单,jquery任何一个教学课程都能找到相应的知识。 在aspx页面和html页面里通过ajax取数据还有什么不同之处吗? $.ajax({ type: "POST", url: "../../PrivateCmsService.svc/GetPagedNews", data: '{"newsKindID":"0101","pageSize":"20","pageIndex":"1"}', dataType: "json", contentType: "text/json;", beforeSend: function (XMLHttpRequest) { $("#newslist").html(String.format(TIPS_TEXT, "<img src='../images/ajax-loader.gif' alt='' />", "请稍候……")); }, error: function (XMLHttpRequest) { $("#newslist").html(String.format(TIPS_ERROR, "ERROR", XMLHttpRequest.responseText)); }, success: function (result) { var context = ""; $.each(result.d, function (i, item) { context += item.Context; }); $("#newslist").html(context); } }); 高分求asp.net教程 QQ的那个登录接口如何配置 服务引用的问题 如何学习ASP.NET,分享给新手们! 网站被挂JS代码 div的Visible属性问题~! 关于动态生成tablecell的问题 ASP.NET中New一个Excel对象提示“无法创建 ActiveX 组件” 用IIS浏览.aspx网页时显示web.config出错 请帮忙。解决立即给分 js加密过的数据如何传到后台 AjaxMethod 的问题
type: "POST",
url: "../../PrivateCmsService.svc/GetPagedNews",
data: '{"newsKindID":"0101","pageSize":"20","pageIndex":"1"}',
dataType: "json",
contentType: "text/json;",
beforeSend: function (XMLHttpRequest) {
$("#newslist").html(String.format(TIPS_TEXT, "<img src='../images/ajax-loader.gif' alt='' />", "请稍候……"));
},
error: function (XMLHttpRequest) {
$("#newslist").html(String.format(TIPS_ERROR, "ERROR", XMLHttpRequest.responseText));
},
success: function (result) {
var context = "";
$.each(result.d, function (i, item) {
context += item.Context;
});
$("#newslist").html(context);
}
});