Passing a <tr> id to jQuery
<p>I'm still learning jQuery and I ran into a problem. I have a table with 50+ rows. Each is labeled with an id.</p>

<pre><code>&lt;tr id="51"&gt;
</code></pre>

<p>This id is the database id and I need to pass it to jQuery and submit it along with an AJAX request.</p>

<pre><code>        $($location).click(function () {
            var $currentSelection = $(this);

            // if there is already an input-field in this TD, return...
            if($currentSelection.find('select').length &gt; 0)
                return;

            $currentSelection.html('');

            $('&lt;select id="selectLocation" onChange="locationSubmit()"/&gt;')
                .attr('name', 'location')
                .append('&lt;option&gt;Location 1&lt;/option&gt;', '&lt;option&gt;Location 2&lt;/option&gt;', '&lt;option&gt;Location 3&lt;/option&gt;')
                .appendTo(this);
        });
</code></pre>

<p><code>locationSubmit()</code></p>

<pre><code>function locationSubmit(){
            var $selectLocation = $('#selectLocation').val();
            var $selectId = $(this).val('tr#id'); //stuck here
            alert($selectId);
            $.ajax({ 
                url: '/ajax/training-update.php',
                data: {
                        action: $selectLocation,
                        courseid: $selectId
                    },
                type: 'POST',
                success: function(output) {
                    alert(output);
                    }
            });
        }
</code></pre>

<p>the alert in <code>locationSubmit()</code> is returning [object Object]. How do I pass the value of <code>tr#id</code> to <code>locationSubmit()</code> and send it via AJAX?</p>

<p>EDIT - HTML</p>

<pre><code>&lt;tr id="51"&gt;
    &lt;td&gt;&lt;a href="/link/goes/here.php?course_id=5&amp;id=51"&gt;course name&lt;/a&gt;&lt;/td&gt;
    &lt;td&gt;
        &lt;span class="rowStartDate" id="rowStartDate151"&gt;09/10/12&lt;/span&gt; - 
        &lt;span class="rowEndDate" id="rowEndDate151"&gt;09/14/12&lt;/span&gt;
    &lt;/td&gt;
    &lt;td class="location"&gt;Location 2&lt;/td&gt;
    &lt;td class="status"&gt;open&lt;/td&gt;
&lt;/tr&gt;
</code></pre>
