我有一个简单的D& D脚本,你可以在这里看到:
I have a simple D&D script as you can see here:
demo.superdit/jquery/dragdrop_cart/
现在它工作正常,直到我试图添加使用AJAX的产品(页面加载后)
Now its working Great until Im trying to add the products with AJAX (After the page loaded)
这是AJAX调用(常规AJAX)
Here is the AJAX call (Regular AJAX)
$.ajax({ url: "Search.php", dataType: 'json', type: 'GET', data: "ebayq="+value, success: function(data){ globalRequest = 0; resultContainer2.fadeOut('fast', function() { resultContainer2.html(''); var html2 = []; for (var i = 0; i < items.length; ++i) { html2 += '<label class="title"><a href="'+viewitem+'" target="_blank">'+title+'</a></label>';html2 += '<img src="'+pic+'">'; html2 += ' <label class="price">New Price: '+myprice+'</label>'; html2 += '</div>'; resultContainer2.append(html2); }我猜因为这些元素是在页面加载后加载的它不会将它们识别为可拖动项目..
i guess because this elements are loaded after the page load and it doesn't recognize them as a draggable items..
有没有办法使这个AJAX项目可拖动?
is there Any way to make this AJAX items draggable??
非常感谢!
推荐答案运行 $('your-selector')。在你的AJAX成功方法中再次使用draggable()。
除非你能找到一种方法来制作 Jquery.on 或 Jquery.live 使用 JqueryUI.Draggable 。
Unless you can find a way to make Jquery.on or Jquery.live to work with JqueryUI.Draggable.
更多推荐
jquery UI draggable不适用于AJAX
发布评论