HTML table representing a database table and a sidebar
I do not like too much this:

var name = $(this).find('td:nth-child(2)').html(); 


I would generally use html5 data attribute on the tr row to pass the id.

example:

&lt;table&gt;
   &lt;tr data-id="1"&gt;&lt;td&gt;bla&lt;/td&gt;&lt;td&gt;bla&lt;/td&gt;&lt;td&gt;bla&lt;/td&gt;&lt;/tr&gt;
   &lt;tr data-id="2"&gt;&lt;td&gt;bla&lt;/td&gt;&lt;td&gt;bla&lt;/td&gt;&lt;td&gt;bla&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

var selectedId = $(this).data("id");