开发者

custom events for handle new object create with ajax call?

I have a page with a div that load the content from a php scrip开发者_StackOverflowt called with jquery/ajax. The content is essentially a file/ folder tree. I need to make these droppable/draggable so I used the .draggable and .droppable jquery's functions. I wrap all in $(window).load (with document.ready doesn't work maybe the ajax call thatr create the elements is called before the js). In this page there is a timer that after 5 minute update the content of the div calling the same function via ajax/jquery. After the update the drag/drop doesn't work anymore, is the problem that jquery can't handle new created object. So what I have to do to make the things right? Should I create a new event after every update and bind the drag/drop on this custom event with .bind/.trigger ?

Hope you understand what I mean


You should be using live or delegate for this.


Have you took a look at the jsTree plugin? IT handles the ajax request, drag and drop and the themeing for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜