views:

144

answers:

2

Hello!

Say I have a list of items from a database. Next to each item there is a delete link. the links look something like: http://example.com/exp/delete/1 - 1 is the ID of the record I want to delete. How can I grab the ID to pass through AJAX?

Thanks

+1  A: 

Just to some string parsing. Find the index of the last / and then get a substring from that index to the end of the string. You'll be left with the id you want.

tmeisenh
A: 

Figure it out!

$(this).attr("href").match(/[^/]*$/i);
mike