Updating multiple select with ajax
But i was confuse with dropdown multiple selected value, but at last i found how to give value, we have to just pass array in val().
See the demo in action Once the top level category select is changed, it sends an AJAX request for the sub-categories. However, the I'm using $_SESSION to store the value of a field to fulfill the where condition because the selection of the data should be dynamic meaning when the user selects the 'Program' from the drop down during add or edit state, the values of the output should be based on it. This code is located in my controller and is set before creating the output... When posting to a controller action this will not be converted to an array (Rails only treats multiple inputs with the same id and a little sugar as an array, see: stackoverflow).To get around this you can define a getter/setter method on your model to handle the array conversion.