table+ajax加载数据
//ajax加载notice
$(function() {
//${pageContext.request.contextPath}/
/**
var res = [
{noticeTitle:'必答题',noticeDate:'2019-08-09'},
{noticeTitle:'必答题',noticeDate:'2019-08-09'},
{noticeTitle:'必答题',noticeDate:'2019-08-09'},
{noticeTitle:'必答题',noticeDate:'2019-08-09'},
{noticeTitle:'必答题',noticeDate:'2019-08-09'}
];
loadNotice(res);
*/
url = "getDatas.do";
$.ajax({
url : url,
type : "post",
dateType : "text",
success : function(res) {
loadNotice(res); //加载notice
}
}); }); //加载notice
function loadNotice(res) {
var tBody = $("#noticeTable").find("tbody");
for ( var index in res) {
//新建一行
var newTr = $("<tr></tr>");
//新建节点
var newsTd = $("<td></td>");
var dateTd = $("<td></td>");
//新建超链接
var newsA = $("<a></a>"); //添加内容和时间
var noticeTitle = res[index].noticeTitle;
var noticeDate = res[index].noticeDate;
/* alert(noticeTitle);
alert(noticeDate); */
newsA.text(noticeTitle);
dateTd.text(noticeDate); //添加数据td-tr-tbody
newsTd.append(newsA);
newTr.append(newsTd);
newTr.append(dateTd);
tBody.append(newTr);
}
}
<table id="noticeTable" class="table table-striped table-hover">
<tr>
<th class="col-md-3">活动标题</th>
<th class="col-md-1">发布时间</th>
</tr>
</table>
table+ajax加载数据的更多相关文章
- 一起学爬虫——如何爬取通过ajax加载数据的网站
目前很多网站都使用ajax技术动态加载数据,和常规的网站不一样,数据时动态加载的,如果我们使用常规的方法爬取网页,得到的只是一堆html代码,没有任何的数据. 请看下面的代码: url = 'http ...
- Ajax 加载数据 练习 自我有些迷糊了,写的大概请谅解 ^ _ ^
查询表的显示,查询显示如果不嵌入PHP代码的话,用ajax怎么实现? <h1>显示数据</h1> <table width="100%" bord ...
- Ajax加载数据的使用
需求就是不能再进入页面时加载数据,只能在点击其中一个按钮时把数据加载呈现出来.具体效果如最下面的图. 1.前台页面 <h1 " onclick="GetData(1)&quo ...
- 【bug】table重新加载数据,页面滚动条下沉到底部,记录scrollTop后将其恢复scrollTop出现闪烁
1.table数据请求前记录scrollTop $scope.scrollPos = document.documentElement.scrollTop; 2.html中添加指令repeat-fin ...
- Ajax加载数据后百度分享实例
<script type="text/javascript"> //百度分享 function baidu_share() { var title_val = $(&q ...
- 前台ajax加载数据
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script> <script sr ...
- ajax 加载数据前的刷新动画
$(document).ready(function(){ $.ajax({ type:"get", cache:false, u ...
- Ajax 滚动异步加载数据
第一种情况:单个div滚动 HTML <body> <!-- search start --> <div class="search" #if($m_ ...
- Bootstrap-Select 动态加载数据的小记
关于前端框架系列的可以参考我我刚学Bootstrap时候写的LoT.UI http://www.cnblogs.com/dunitian/p/4822808.html#lotui bootstrap- ...
随机推荐
- 图论小专题C
3 负环及其应用 3.1 判定算法 判断负环只能用"边松弛"算法,也就是Bellman-Ford和SPFA算法.这两个算法都是\(O(NM)\)级别的.因为负环中一定存在一条负边, ...
- C# Unicode编码解码
public static class CommpnHelpEx { /// <summary> /// unicode编码 /// </summary> /// <pa ...
- JavaWeb_(Spring框架)SpringAOP面向切面编程
SpringAOP:面向切面编程(面向fifter编程) 通俗易懂术语:所有纵向重复的代码,我们提取成横向的代码 以下文章内容参考知乎:从0带你学习SpringAOP,彻底的理解AOP思想 传送门 1 ...
- 更新ubuntu的对应源配置文件
UBUNTU中安装依赖包,出现如下错误:E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/o ...
- .net reflector
https://www.red-gate.com/dynamic/products/dotnet-development/reflector/download https://github.com/s ...
- ThinkPHP空操作与命名空间
命名空间:相当于一个虚拟的目录 正常管理文件使用文件夹--物理区分 TP框架的初始命名空间是:ThinkPHP\Library 在TP框架下命名空间里面使用\代表的是初始命名空间(ThinkPHP\L ...
- 性能分析 | MySQL 的慢查分析实例
最近遇见一个 MySQL 的慢查问题,于是排查了下,这里把相关的过程做个总结. 定位原因 我首先查看了 MySQL 的慢查询日志,发现有这样一条 query 耗时非常长(大概在 1 秒多),而且扫描的 ...
- linux下如何查看某个容器的详细信息?
答: 使用docker inspect <CONTAINER ID>即可
- 【Taro全实践】Taro在微信小程序中的生命周期
一.Taro的本身生命周期 生命周期componentWillMount在微信小程序中这一生命周期方法对应页面的onLoad或入口文件app中的onLaunch componentDidMount在微 ...
- 11. Ingress及Ingress Controller(主nginx ingress controller)
11. Ingress,Ingress Controller拥有七层代理调度能力 什么是Ingress: Ingress是授权入站连接到达集群服务的规则集合 Ingress是一个Kubernetes资 ...