zoukankan      html  css  js  c++  java
  • 回掉函数

    回调概念
    1.不直接返回结果
    2.在函数的参数中传递回掉函数
    3.在回掉中处理返回结果

    function callAjax(isPass, id, success, error){
                    console.log(isPass);
                    $.ajax({
                        url: "{:U('question/examine')}",
                        type: "POST",
                        data: {
                            pass: isPass,
                            id: id
                        },
                        dataType: 'json',
                        success: success,
                        error: error
                    });
                }
    
    
                        callAjax(true, id, function(data){
                            $('#table-body tr').each(function(){
                                if($(this).attr('data-id') == id){
                                    $(this).attr('isChecked', true);
                                    $(this).find('.changedStatu').text('通过审查');
                                    $(this).css({
                                        'color': 'green',
                                        'font-weight': 'bolder'
                                    });
                                    $('.body-bottom').hide('fast');
                                    selectNextStep(data);
                                }
                            });
                            isProcessing = false;
                            layer.close(index);
                        }, function(data){
                            console.log(data);
                            alert('Fail');
                            layer.close(index);
                        });
  • 相关阅读:
    WC命令
    dcoker machine
    linux命令
    Valgrind 检测程序内存使用
    golang flag
    面试之---二叉树的遍历
    FFMpeg 版本错误
    C++中namespace的使用
    QT之QStatusBar
    建立ftp服务器和客户端
  • 原文地址:https://www.cnblogs.com/suxiaolong/p/5948547.html
Copyright © 2011-2022 走看看