The primary key of my table is located at the second column and third column (in this case Area and Station/combination of the two).
I have a checkbox field in front of every row.
Now, I want to send an ajax request on click of some links but I want to send the table row that was clicked
and send both of my primary key.
I tried to come up with below jquery code but I think its a little messy. Can you share to me another way of thinking for this?
Thanks
Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
You'd add a class or id on each row to contain the data you want to include rather than doing arbitrarily deep DOM traversals to get the data. It also decouples the data from its presentation.
Mark Reyes
Ranch Hand
Joined: Jul 09, 2007
Posts: 426
posted
0
Hi David,
You'd add a class or id on each row to contain the data you want to include rather than doing arbitrarily deep DOM traversals to get the data. It also decouples the data from its presentation.
Thanks for the clarification..
In some of my tables that has make-up key (like autogenerated key), I usually set the value of the checkbox to the autogenerated key. During link click, its easier to send the
key to the server.
But in this case, my table doesnt have an autogenerated or makeup key. The keys are composite of AreaCode + station code.
I initially thought of doing this.
But I am a bit reluctant in doing this. So I decided to fall back to DOM traversal using the Jquery functions?
Another nice solution is jQuery's metadata plugin. It is especially useful if you need more than just 1 piece of data.
I suspect this will be part of jQuery core before long since jQuery already supports attaching data to DOM elements using $.data() method.
Mark Reyes
Ranch Hand
Joined: Jul 09, 2007
Posts: 426
posted
0
Hi Bear,
I will frequently use HTML5-style custom attributes to capture such data easly
I dont know much about HTML 5 attributes, but I googled and found john resig blog. This brings me to my next question though, I havent tested this but will this work with IE6?
I am afraid that I dont have the freedom to select my targeted browser and I need to support this.