Javascript 基于类jQuery提交表行

Javascript 基于类jQuery提交表行,javascript,jquery,model-view-controller,Javascript,Jquery,Model View Controller,我在用电话。我使用它来更改被单击的表行的类别,使它们看起来“选中”。然后,我希望能够使用sumbit或将这些行中的数据发送回MVC应用程序。我尝试在单击行时将它们添加到数组中,但我无法使inaray功能正常工作,因此单击按钮时只发送class='selected'行可能会更容易 $('#classes tbody').on('click', 'tr', function () { $(this).toggleClass('selected'); }); $('#WatchButton

我在用电话。我使用它来更改被单击的表行的类别,使它们看起来“选中”。然后,我希望能够使用sumbit或将这些行中的数据发送回MVC应用程序。我尝试在单击行时将它们添加到数组中,但我无法使
inaray
功能正常工作,因此单击按钮时只发送
class='selected'
行可能会更容易

$('#classes tbody').on('click', 'tr', function () {
    $(this).toggleClass('selected'); 
});

$('#WatchButton').click(function () {
    //Not sure how to send the 'selected' rows        
});
表格示例:

<table id="classes" class="display" cellspacing="0" width="100%">
<thead>
    <tr>
            <th>OpenClosed</th>
            <th>Section</th>
            <th>CRN</th>
            <th>Credit Hours</th>
            <th>Part/Term</th>
            <th>Capacity</th>
            <th>Enrolled</th>
            <th>Seats Available</th>
            <th>Waitlist Capacity</th>
            <th>Waitlist Count</th>
            <th>Waitlist Availability</th>
            <th>Campus</th>
            <th>Method</th>
            <th>Location</th>
            <th>Time</th>
            <th>Start Date</th>
            <th>End Date</th>
            <th>Instructor</th>
            <th>Days</th>
    </tr>
</thead>
<tbody>
        <tr>
                <td><IMG SRC='https://owlexpress.kennesaw.edu/stugifs/open.gif'></td>
                <td>MATH 0989/01 - Foundations of College Algebra</td>
                <td>80637</td>
                <td>       3.000</td>
                <td>Full Term</td>
                <td>15</td>
                <td>5</td>
                <td>10</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>Kennesaw Campus</td>
                <td>Classroom - 100%</td>
                <td>LibraryRoom 461</td>
                <td>12:30 pm - 1:45 pmLecture</td>
                <td>Aug 17, 2015</td>
                <td>Dec 14, 2015</td>
                <td>Bhupinder   Naidu (P)</td>
                <td></td>
        </tr>
        <tr>
                <td><IMG SRC='https://owlexpress.kennesaw.edu/stugifs/open.gif'></td>
                <td>MATH 0989/02 - Foundations of College Algebra</td>
                <td>80639</td>
                <td>       3.000</td>
                <td>Full Term</td>
                <td>15</td>
                <td>0</td>
                <td>15</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>Kennesaw Campus</td>
                <td>Classroom - 100%</td>
                <td>LibraryRoom 430</td>
                <td>6:30 pm - 7:45 pmLecture</td>
                <td>Aug 17, 2015</td>
                <td>Dec 14, 2015</td>
                <td>Bonnie W  Sellers (P)</td>
                <td></td>
        </tr>
        <tr>
                <td><IMG SRC='https://owlexpress.kennesaw.edu/stugifs/open.gif'></td>
                <td>MATH 0989/03 - Foundations of College Algebra</td>
                <td>85687</td>
                <td>       3.000</td>
                <td>Full Term</td>
                <td>15</td>
                <td>3</td>
                <td>12</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>Kennesaw Campus</td>
                <td>Classroom - 100%</td>
                <td>LibraryRoom 462</td>
                <td>9:30 am - 10:45 amLecture</td>
                <td>Aug 17, 2015</td>
                <td>Dec 14, 2015</td>
                <td>Bhupinder   Naidu (P)</td>
                <td></td>
        </tr>
</tbody>
</table>

开闭式
部分
CRN
学时
部分/术语
容量
登记
有座位吗
等待名单容量
等待名单计数
等待名单可用性
校园
方法
位置
时间
开始日期
结束日期
教练
天
数学0989/01-大学代数基础
80637
3
足月
15
5.
10
0
0
0
肯尼索校区
教室-100%
图书馆461室
下午12:30至1:45
2015年8月17日
2015年12月14日
布宾德·奈杜(P)
数学0989/02-大学代数基础
80639
3
足月
15
0
15
0
0
0
肯尼索校区
教室-100%
430室
下午6:30至7:45
2015年8月17日
2015年12月14日
邦妮·W·塞勒斯(P)
数学0989/03-大学代数基础
85687
3
足月
15
3.
12
0
0
0
肯尼索校区
教室-100%
图书馆462室
上午9:30至10:45
2015年8月17日
2015年12月14日
布宾德·奈杜(P)

我猜您是在问如何获取所选行的数组,对吗

$('#WatchButton').click(function () {
   var selectedrows = $('tr.selected');
});