Uniquely identifying the time/patient record is important. This becomes obscured when you alter the rowspan of the name.
Below is the code I used:
Note: I added a class called "time" to the time elements and added a div element to contain the resultant html called "container".
$("#btnAllot").click(function ()
{
var container = $("#container");
var times = $("td.yell.time");
var html = "";
container.empty();
for(var i = 0; i < times.length; i++)
{
html += $(times.get(i))
.parent(".csstablelisttd").get(0).outerHTML;
}
container.html(html);
});
First I get all of the "time" td's that have a corresponding patient (identified by "yell"). Then I iterate over these items:
In the iteration, first the current "time" td is retrieved by the index "i". I then get it's "csstablelisttd" parent. This allows you to obtain a list of "csstablelisttd" elements that contain a time/patient value pair. With this, you can parse into an object and pass to the web server.
You would probably add the time and patient to a time/patient object array like so:
http://jsfiddle.net/rEvBp/