Hi all,
Basically there are two tables: Companies and visitors. Currently it's possible to drag visitors to companies. Works great. As soon as the drop function occurs, there are two $.post's. The first one saves the drag to the database. The second one updates the visitors, because the information constantly changes. The problem, however is that as soon as the second $.post finishes, Firebug keeps popping the following error:
d(this).data("draggable") is null
Which occurs in the jQuery UI file. On line 56.
about 400 times or so. So basically I'm looking for a way to do live() with draggable and droppable.
The .draggables are in #visitors (an ul). The droppables are in #companies (a table).
Thanks!
$(".draggable").draggable({
revert:true
});
$(".droppable").droppable({
drop: function(ev, ui) {
$(this).text($(ui.draggable).text());
$.post('planning/save_visit', {user_id: $(ui.draggable).attr('id'), company_id: $(this).attr('id'), period: $('ul.periods li.active').attr('id')});
$.post('planning/' + $('ul.periods li.active').attr('id'), {visitors:true}, function(data){
$('#visitors').html(data);
});
},
hoverClass: 'drophover'
});