jquery UI draggable不适用于AJAX

编程入门 行业动态 更新时间:2024-10-28 18:27:59
本文介绍了jquery UI draggable不适用于AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个简单的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

本文发布于:2023-11-24 21:38:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626941.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   UI   jquery   AJAX   draggable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!