Jquery-ui draggable不能在ajax块中工作

jquery-ui draggable doesn't work inside an ajax block

本文关键字:工作 ajax draggable 不能 Jquery-ui      更新时间:2023-09-26

我似乎不能改变放置块内的ajax块中的_drag选项。使用jQuery 1.6和1.7与jQuery ui 1.8.6和1.8.16。

$('div.equippment').droppable({
  accept: 'div.my_wep, div.store_wep',
  tolerance: 'intersect',
  drop: function(e, ui) {
    var _drop = $(this), _drag = ui.draggable, _class = _drag.attr('class'), _swapsell = false, _dragid = _drag.find('img').attr('name');
    $.ajax({
      type: 'POST',
      dataType: 'json',
      url: _url,
      data: ({to_inv: _from_store, slot: _drop.attr('id').replace('slot_','')}),
      success: function(data) {
        _drag.draggable("option","revert",true); // Doesn't work yay
      }
    });
   }
});

你得到任何错误吗?看来你需要关闭success函数