ajax hash方法,jquery 遍历hash操作示例【基于ajax交互】

本文提供了一个jQuery实现的示例,展示如何遍历hash并对数据进行操作,同时介绍了如何动态渲染当前时间。示例中包含HTML样式和JavaScript代码,用于创建一个监控界面,展示了对数据的处理和页面元素的更新方法。
摘要由CSDN通过智能技术生成

本文实例讲述了jquery 遍历hash操作。分享给大家供大家参考,具体如下:

运维平台

*{margin: 0; padding: 0;}

body{font-size: 20px; color: #333;}

h1{position: relative; height: 100px; line-height: 100px; margin: 0; background: #555; color: #f2f2f2; font-size: 25px; text-align: center;}

ul,ol,li{list-style-type: none;}

#list{

margin: 0 auto;

padding-top: 4px;

}

#list ul{

display: flex;

flex-wrap: wrap;

margin-top: 30px;

}

/*+设置框框大小 */

#list li{

flex: 1;

min-width: 100px;

min-height: 50px;

margin: 2px 4px;

padding: 5px 10px;

border: 1px solid #eee;

}

#list .name{

font-weight: bold;

font-size: 20px;

}

#list .red{

color: #fff;

font-weight: bold;

background: #f00;

background: rgba(255,0,0,.8);

}

#list .red p span{

color: #fff;

}

#list .yellow{

font-weight: bold;

background: #ff0;

background: rgba(255,255,0,.8);

}

#list .green{

background: #0f0;

background: rgba(0,255,0,.8);

}

#list .died{

background: #666;

background: rgba(162,162,162,.8);

color: #fff;

}

#list p{

padding-top: 3px;

}

#list p span{

color: #f00;

font-weight: bold;

}

.time{

position: absolute; top: 0px; right: 20px;

color: #fff;

font-size: 25px;

}

泰隆银行DB运行监控/60s

$(function(){

var renderTime = function() {

var now = new Date();

var y = now.getFullYear();

var m = now.getMonth() + 1;

var d = now.getDate();

var h = now.getHours();

var i = now.getMinutes();

var s = now.getSeconds();

m = m < 10 ? '0' + m : m;

d = d < 10 ? '0' + d : d;

h = h < 10 ? '0' + h : h;

i = i < 10 ? '0' + i : i;

s = s < 10 ? '0' + s : s;

var _date = y + '-' + m + '-' + d;

var _time = h + ':' + i + ':' + s;

$('.time').html(_date + ' ' + _time);

};

var render = function(data) {

console.log('111111111111111111111');

console.log(data);

console.log('111111111111111111111');

for (var k in data){

console.log('222222222222222222222');

console.log(k+'=>'+data[k]);

console.log(data[k]);

console.log('222222222222222222222');

for (var p in data[k]){

console.log('3333333333333333333333');

console.log(p+'=>'+data[k][p]);

console.log('3333333333333333333333');

};

};

};

var getOracleService = function(error) {

$.ajax({

url: '/returnmq/',

type: 'GET',

data: {},

async: false,

dataType: 'json',

success: function(res) {

render(res);

},

error: function(res) {

// alert("数据返回出错");

}

});

}

getOracleService();

});

1f0c9700e43fc1740aea2224f32c5a57.png

希望本文所述对大家jQuery程序设计有所帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值