jquery 遍歷hash操作示例【基于ajax交互】
本文實(shí)例講述了jquery 遍歷hash操作。分享給大家供大家參考,具體如下:
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>運(yùn)維平臺</title> <style type="text/css"> *{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; } /*+設(shè)置框框大小 */ #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; } </style> </head> <body> <h1>泰隆銀行DB運(yùn)行監(jiān)控/60s<span class="time"></span></h1> <ul id="list"></ul> <!-- <script src="http://libs.mingsixue.com/jquery/1.12.4/jquery.min.js"></script> --> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script> $(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("數(shù)據(jù)返回出錯(cuò)"); } }); } getOracleService(); }); </script> </body> </html>
更多關(guān)于jQuery相關(guān)內(nèi)容可查看本站專題:《jquery中Ajax用法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery常見經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。
相關(guān)文章
jQuery實(shí)現(xiàn)用方向鍵控制層的上下左右移動(dòng)
本文將會(huì)使用jquery實(shí)現(xiàn)以下功能:按下方向鍵時(shí),使層向相應(yīng)的方向平滑移動(dòng)20像素;四個(gè)方向鍵的鍵碼分別是37(左)、38(上)、39(右)和40(下),感興趣的朋友可以了解下2013-01-01jQuery實(shí)現(xiàn)自動(dòng)與手動(dòng)切換的滾動(dòng)新聞特效代碼分享
這篇文章主要介紹了jQuery實(shí)現(xiàn)列表自動(dòng)循環(huán)滾動(dòng)手動(dòng)滾動(dòng)展示新聞,推薦給大家,有需要的小伙伴可以參考下。2015-08-08Jquery利用mouseenter和mouseleave實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出層且可以點(diǎn)擊
這篇文章主要介紹了Jquery利用mouseenter和mouseleave實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出層且可以點(diǎn)擊。需要的朋友可以過來參考下,希望對大家有所幫助2014-02-02jquery實(shí)現(xiàn)跳到底部,回到頂部效果的簡單實(shí)例(類似錨)
下面小編就為大家?guī)硪黄猨query實(shí)現(xiàn)跳到底部,回到頂部效果的簡單實(shí)例(類似錨)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-07-07jquery解析XML及獲取XML節(jié)點(diǎn)名稱的實(shí)現(xiàn)代碼
下面小編就為大家?guī)硪黄猨query解析XML及獲取XML節(jié)點(diǎn)名稱的實(shí)現(xiàn)代碼。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05