当前位置:首页 > Web开发 > 正文

标签: jQuery全局事件处理函数 !DOCTYPE htmlhtml lang="en"head meta cha

2024-03-31 Web开发

标签:

jQuery全局事件措置惩罚惩罚函数

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery全局事件措置惩罚惩罚函数</title> <style> .loading { display: none; position: fixed; } </style> </head> <body> <div>正在玩命加载中...</div> <button>请求</button> <script src="http://www.mamicode.com/jquery.js"></script> <script> $(document) .ajaxStart(function () { // 只要有 ajax 请求产生 就会执行 $(‘.loading‘).fadeIn() // 显示加载提示 console.log(‘注意即将要开始请求了‘) }) .ajaxStop(function () { // 只要有 ajax 请求结束 就会执行 $(‘.loading‘).fadeOut() // 结束提示 console.log(‘请求结束了‘) }) $(‘#btn‘).on(‘click‘, function () { // $.ajax({ // url: ‘time.php‘ // }) $.get(‘time.php‘) }) </script> </body> </html>

技术图片

AJAX---jQuery全局事件措置惩罚惩罚函数

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/30290.html