title: Rails and jQuery sending Ajax requests
body: <p>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:</p>
  
  <pre><code>a(this).data("draggable") is undefined
  </code></pre>
  
  <p>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</p>
  
  <pre><code>&lt;%= drop_receiving_element drop_id,
              :onDrop =&gt; "function(ev,ui){
            if (confirm(\"#{escape_javascript(_('This will add User to this Group, are you sure?'))}\"))
            {#{remote_function(:update =&gt; 'module_content',
            :url =&gt; {:controller =&gt; :projects,
            :action =&gt; :member_change,
            :id =&gt; @project.id},
            :with =&gt; "'u=' + encodeURIComponent($(ui.draggable).attr('id')) + '&amp;r=' + encodeURIComponent($(this).attr('id'))"
            )};}
            }",
              :accept =&gt; '.RolesUsersSelection',
              :update =&gt; 'roles_edit',
              :url =&gt; {:controller =&gt; :projects, :action =&gt; :role_user_update},
              :hoverclass =&gt; "#{drop_class}_active"
          %&gt;
  </code></pre>
  
  <p>And this is the JavaScript created by jrails and jquery:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  //&lt;![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'})
  //]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>Im guessing it's got something to do with the <code>($(this).attr('id'))</code> but im not sure what else should be there...
  Thanks,</p>