在回调函数前边的一个函数里执行了return,还能进入回调函数吗?

解决方案 »

  1.   

    return后面的代码不会执行,这个要看你回调函数在什么情况下触发了
      

  2.   

    比如说我读取后台的数据,然后在获取到数据进入回调函数之前,在另一个函数里执行了一次return,我还能进入这个回调函数吗?
      

  3.   

    jQuery.ajax({
                url: "/Ajax/AjaxSiteStatus.ashx?rnd=" + Math.random(),
                type: "get",
                success: function (status) {}});
    在进入success之前,执行了一次return,还能进入success吗?
      

  4.   

    在进入success之前,执行了一次return,还能进入success吗?
    re:
    在哪执行的呀?
      

  5.   


    var xhr=$.ajax({
    type: "GET",
    url:'/ajax.php?a=check_comment',
    data:{ comment_id: value}
    });
    return;
    xhr.done(function( date ) {
    try{
    var mj=jQuery.parseJSON(date);
    if(mj!==null){
    $('#comment_pid').val(mj.id).next('textarea').html('').focus();
    }
    }catch(exception){
    eval(date);
    }
                });这种是不会执行回调的
      

  6.   

    另一个函数里,在这个函数结束后,会进入一个加载判断函数,执行了一次return
      

  7.   


    Query.ajax({
                url: "/Ajax/AjaxSiteStatus.ashx?rnd=" + Math.random(),
                type: "get",
                success: function (status) {}});
    return;
      

  8.   


    Query.ajax({
                url: "/Ajax/AjaxSiteStatus.ashx?rnd=" + Math.random(),
                type: "get",
                success: function (status) {}});
    return;
    上面的代码已经注册了请求成功后的回调了.像下面这种complate回调会不被调用 var xhr=$.ajax({
    type: "GET",
    url:'/ajax.php?a=check_comment',
    data:{ comment_id: value}
    }).success(function(date){
    try{
    var mj=jQuery.parseJSON(date);
    if(mj!==null){
    $('#comment_pid').val(mj.id).next('textarea').html('').focus();
    }
    }catch(exception){
    eval(date);
    }
                });
    return;
    xhr.complete(function(){
    alert('xhr is complate');
    });