I want to pass the value that I take from javascript to the controller. But I do not use any function. I just want to access the value that I get from the view in the controller. I have the following view.
<select id="selected_year" name="selected_year" data-live-search="true" style="margin-left: 27px;" > <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> <option value="2021">2021</option> <option value="2022">2022</option> <option value="2023">2023</option> <option value="2024">2024</option> </select>
I get the value of the dropdown using the following javascript.
<script type="text/javascript"> $("#selected_year").live('change', function() { var selected_year = $(this).attr("value"); alert(selected_year); window.location.reload(); }); </script>
I want to just pass the value that I get from the above javascript to the controller. Can this be done?
source share