<script src="/static/js/jquery-2.1.1.min.js"></script> <script> function sleep(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } } </script>
Ajax 自执行函数
function ajax_send(func){ var query = new Object(); $.ajax({ url:‘/alert_view‘, type:‘GET‘, data:‘‘, success:function (data) { var data = JSON.parse(data); for (key in data) { document.getElementById(key).style.height = data[key] + ‘px‘; } }) } //自执行函数 (function (data) { ajax_send(function (data) { if (data.status==1){ console.log(data); } }); })(); // 1.2s执行一次 setInterval(ajax_send,1200) </script>
原文地址:https://www.cnblogs.com/zl-py/p/9903934.html
时间: 2024-10-06 18:27:41