Hi I currently have a Rails app that uses the jQuery library to run the ajax requests. However i've run into a slight problem as the ajax request that is being sent out is giving me an error:
a(this).data("draggable") is undefined
The rails program is supposed to take a draggable object and drop it in a valid container and then update the properties of the draggable object to reflect the new permissions given by dragging and dropping. So its basically a way to organize permissions but through dragging and dropping. This is the Rails code
<%= drop_receiving_element drop_id,
:onDrop => "function(ev,ui){
if (confirm(\"#{escape_javascript(_('This will add User to this Group, are you sure?'))}\"))
{#{remote_function(:update => 'module_content',
:url => {:controller => :projects,
:action => :member_change,
:id => @project.id},
:with => "'u=' + encodeURIComponent($(ui.draggable).attr('id')) + '&r=' + encodeURIComponent($(this).attr('id'))"
)};}
}",
:accept => '.RolesUsersSelection',
:update => 'roles_edit',
:url => {:controller => :projects, :action => :role_user_update},
:hoverclass => "#{drop_class}_active"
%>
And this is the JavaScript created by jrails and jquery:
<script type="text/javascript">
//<![CDATA[
jQuery('#RemoveThisMember').droppable({accept:'.RolesUsersSelection', drop:function(ev,ui){
if (confirm("This will remove User from this Group, are you sure?"))
{jQuery.ajax({data:'u=' + encodeURIComponent($(ui.draggable).attr('id')), success:function(request){jQuery('#module_content').html(request);}, type:'post', url:'/of/projects/11/member_delete'});}
}, hoverClass:'ProjectRoleDropDelete_active'})
//]]>
</script>
Im guessing it's got something to do with the ($(this).attr('id')) but im not sure what else should be there...
Thanks,