title: Jquery tableDnD - How to create an ajax with ID and position ondrop?
body: <p>My code:</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
      // Initialise the table
      $('#admintabel').tableDnD({
          onDrop: function(table, row) {
  
          }
      });
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>How do I create an ajax call to example <code>/sort</code> with the parameters position and ID in a has like this: <code>[position, ID]</code> onDrop? And how should my table be like. </p>
  
  <p><strong>Update:</strong></p>
  
  <p>I am trying to create an array like:</p>
  
  <pre><code>BREDBANDS[id]   1
  BREDBANDS[id]   2
  BREDBANDS[id]   3
  </code></pre>
  
  <p>My current test data:</p>
  
  <pre><code>data: {
                    BREDBANDS: [1, 2, 3]                  },
  </code></pre>
  
  <p>And it is posting this:</p>
  
  <pre><code>BREDBANDS[] 1
  BREDBANDS[] 2
  BREDBANDS[] 3
  </code></pre>
  
  <p>Which is giving a 500 error. </p>
  
  <p>My Rails action which the data is posted to:</p>
  
  <pre><code>  def sort
    params[:bredbands].each_with_index do |id, index|
      Bredband.update_all(['position=?', index+1], ['id=?', id])
    end
    render :nothing =&gt; true
  end
  </code></pre>