Jquery事件触发命令

时间:2017-11-06 16:57:46

标签: javascript jquery

为什么包含ajax请求的函数调用会在追加之前触发?

$("#range").on("click", function(){
    $("#control").empty().append(.....); //why does this get executed after?
    var data = 'something';
    some_function_with_ajax(data);  
 }


function some_function_with_ajax(data){
      $.ajax({
        url: '/url',
        type: 'POST',
        data: {data: data},
        success: function(resp){
          // seems the append actually happens here  
        }
    });
}

0 个答案:

没有答案