jquery UI draggable不适用于AJAX [英] jquery UI draggable doesn't work with AJAX

查看:84
本文介绍了jquery UI draggable不适用于AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的D& D脚本,你可以在这里看到:

I have a simple D&D script as you can see here:

http://demo.superdit.com/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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆