jquery - convert to string to array in ruby or javascript to be in used in an SQL query -


i trying convert string array either in ruby on rails or in javascript or jquery.

in code, values of strings select option. on option selected, capture value returns string

var lenders = $(this).val(); 

this string returns. line of id numbers separated commas "15,16,17" , want convert array [15, 16, 17] either in ruby or in javascript.

how achieve this?

i have tried doing

"15,16,17".split(',') 

i have tried doing "15,16,17".to_a

but no avail

"15,16,17".split(',').map(&:to_i) trick


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -