I have a requirement to supply values from 2 select boxes to an Action Method. I’d like to know if there’s a way to automatically extract all of the attributes from the selected options from each select box into a data object that I can pass to the server with my $.get?
Ideally, I could use a function like this:
http://plugins.jquery.com/node/6530
var data = $.getAttributes($('#lstFilter option:selected'))
this works perfectly for single element but this it’s no good for multiple elements because it returns a json object that can’t be appended to.
Can anyone suggest a work around or a different approach that i could take to get a result?
Thanks
Dave
You’d best do this with
map():The above returns an array of values. You may need to identify the source of each value, in which case you’ll need something like:
which creates an anonymous object of all the
<select>values.