543day(jquery-ajax-callback.html)

《2019年3月31日》【连续 543天】

标题:jquery-ajax-callback.html;
内容:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>jQuery中AJAX的回调</title>
</head>
<body>
  <script src="jquery.js"></script>
  <script>

    // 原生操作中不管请求状态码是多少都会触发回调
    // var xhr = new XMLHttpRequest()
    // xhr.open('get', 'time1.php')
    // xhr.send()
    // xhr.onreadystatechange = function () {
    //   if (this.readyState !== 4) return
    //   console.log(this.responseText)
    // }

    // 显示 loading

    $.ajax({
      url: 'time.php',
      type: 'get',
      beforeSend: function (xhr) {
        // 在所有发送请求的操作(open, send)之前执行
        console.log('beforeSend', xhr)
      },
      success: function (res) {
        // 隐藏 loading
        // 只有请求成功(状态码为200)才会执行这个函数
        console.log(res)
      },
      error: function (xhr) {
        // 隐藏 loading
        // 只有请求不正常(状态码不为200)才会执行
        console.log('error', xhr)
      },
      complete: function (xhr) {
        // 不管是成功还是失败都是完成,都会执行这个 complete 函数
        console.log('complete', xhr)
      }
    })

  </script>
</body>
</html>

 

$(document).ready(function () { $("body").addClass("nav-function-hidden"); jQuery.fn.dataTable.Api.register( 'processing()', function ( show ) { return this.iterator( 'table', function ( ctx ) { ctx.oApi._fnProcessingDisplay( ctx, show ); } ); } ); view_panel = $('#main_view').smartPanel({ fullscreenButtonLabel: "全屏显示", lockedButtonLabel: "锁定位置", colorButtonLabel: "颜色", buttonOrder: '%collapse% %fullscreen%', collapseButton: true, onFullscreen: function(panel){ switch(panel[0].id){ case "ModulePassdownTroublesPanelDiv": trouble_list_table.adjust_columns(); break; default: break; } }, onCollapse: function() { }, fullscreenButton: true, }); new_trouble_form_obj = new NewTroubleForm({ timeout1: 600000, new_trouble_success_callback: new_trouble_form_obj_new_trouble_success_callback, }); trouble_list_table = $("#ModulePassdownTroublesTable").TroubleListTable({ height: null, record_dbclick_callback: trouble_list_table_record_dbclick_callback, }); offline_ocap_table = $("#OfflineOcapTable").OcapTable({ lot_click_callback: table_lot_click_callback, update_click_callback: offline_ocap_table_update_click_callback, timeout1: _timeout1, }); inline_ocap_table = $("#InlineOcapTable").OcapTable({ lot_click_callback: table_lot_click_callback, update_click_callback: inline_ocap_table_update_click_callback, timeout1: _timeout1, }); run_card_history_table = $("#RunCardHistoryTable").RunCardHistoryTable({ update_click_callback: run_card_history_table_update_click_callback, lot_click_callback: table_lot_click_callback, timeout1: _timeout1, }); hold_lot_table = $("#HoldLotTable").HoldLotTable({ update_click_callback: hold_lot_table_update_click_callback, lot_click_callback: table_lot_click_callback, contextmenu_new_lot_tracing_callback: hold_lot_table_contextmenu_new_tracing_callback, timeout1: _timeout1, }); var _fromday = moment().add(-1, 'days'); var _today = moment(); $('#ReportTablesRangedateInput').daterangepicker({ timePicker: true, startDate: _fromday, endDate: _today, timePicker24Hour: true, timePickerSeconds: true, locale: { format: 'YYYY/MM/DD HH:mm:ss' }, }); //需求:20250227-002 张宇恒修改 20250326 $("#ModulePassdownModuleSelector").on("click", open_module_selector); $("#ModulePassdownDayShiftBtn").on("click", switch_day_shift); $("#ModulePassdownNightShiftBtn").on("click", switch_night_shift); $("#ModulePassdownPreShiftBtn_start").on("click", move_pre_start); $("#ModulePassdownNextShiftBtn_start").on("click", move_next_start); $("#ModulePassdownPreShiftBtn_end").on("click", move_pre_end); $("#ModulePassdownNextShiftBtn_end").on("click", move_next_end); $("#ModulePassdownNowBtn").on("click", set_now_date); $("#ModulePassdownNewTroubleBtn").on("click", open_new_trouble_form_window); $("#ModulePassdownSearchTroubleBtn").on("click", open_search_trouble_window); $("#ModulePassdownReviewBtn").on("click", open_review_mode); $("#ModulePassdownDateSetInput_start").on("change", set_selected_date_start); $("#ModulePassdownDateSetInput_end").on("change", set_selected_date_end); $("#tab-OfflineOcap-a").on("shown.bs.tab", function(e){ offline_ocap_table.adjust_columns(); }); $("#tab-InlineOcap-a").on("shown.bs.tab", function(e){ inline_ocap_table.adjust_columns(); }); $("#tab-RunCardHistory-a").on("shown.bs.tab", function(e){ run_card_history_table.adjust_columns(); }); $("#tab-HoldLot-a").on("shown.bs.tab", function(e){ hold_lot_table.adjust_columns(); }); load_localStorage(); move_trace_panel_init(); set_now_date(); update_input_date(); module_report_table_panel_init() });详细解释这段代码
最新发布
01-06
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值