Selector, droppable, and ajax

Selector, droppable, and ajax

I need to say that I am not strong at Javascript nor jQuery. So my questions may be novice. I have something like followings:

  1. <div id="droppable">
  2.       <table>
  3.             <thead> 
  4.             <tr>
  5. <th class="span-2">Column 1</th> 
  6. <th class="span-1">Column 2</th>
  7. <th class="span-1">Column 3</th>
  8.       </tr>
  9.   </thead> 
  10.         <tbody> 
  11. <tr>
  12. <td class="span-2">...</td>
  13. <td class="span-1">...</td>
  14. <td class="span-1">...</td>
  15. </tr>
  16. </tbody>      
  17.        </table>
  18.  </div>
and 
  1. <script type="text/javascript"> 
  2. $(document).ready(function () {
  3. var itemName = document.getElementById("name").value;
  4.     var options = {
  5.         caption:    false,
  6.         navigation: 'hover',
  7.         direction:  'right'
  8.     }
  9.  ...
  10.     $("#droppable").droppable({
  11.      tolerance:'touch',   
  12.        drop: function() { 
  13.        $(this).append("<tr><td class='span-2'>").append("new item").append("</td><td class='span-1'>").append("1").append("</td><td class='span-1'>").append("10.00").append("</td></tr>"); 
  14.        }
  15.     });
  16. });
  17. </script> 
I get all data in the droppable box and it functions as designed. The data format is not correct, however. I think it is caused by an incorrect selector. I believe that path shall be "table tbody", but just can't put it right.

And what is a right way to refer a string on the same page? I try to get a string in the element ID "name", but append(document.getElementById("name").value) inside of the drop: function() yields a blank.

Also, how to invoke a URL like /somethings/doSomething inside of the drop: function()? I need to call a server function when something is dropped into the droppable box.


Thanks for your inputs in advance.