wrb Posted April 7, 2015 Share Posted April 7, 2015 How could pass the value of a selected item in a select in the url below to replace the 1: <select id="animais" name="cod_animal" class="form-control"></select> <script type="text/javascript"> google.load('visualization', '1.1', { 'packages': ['corechart'] }); google.setOnLoadCallback(drawChart); function drawChart() { var url = '/ Programa_Nutricao / Evaluation / EvolucaoPeso /' + 1; Link to comment Share on other sites More sharing options...
justsomeguy Posted April 7, 2015 Share Posted April 7, 2015 This is how to get the selected value of a select element:http://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript Link to comment Share on other sites More sharing options...
wrb Posted April 7, 2015 Author Share Posted April 7, 2015 This is correct? <script type="text/javascript"> google.load('visualization', '1.1', { 'packages': ['corechart'] }); google.setOnLoadCallback(drawChart); function drawChart() { var e = documento.getElementById("#animais"); var animais = e.opções[e.selectedIndex].valor; var url = '/Programa_Nutricao/Avaliacao/EvolucaoPeso/' + animais; Link to comment Share on other sites More sharing options...
justsomeguy Posted April 7, 2015 Share Posted April 7, 2015 That's not correct, object and property names are in English, not Portuguese. Link to comment Share on other sites More sharing options...
wrb Posted April 7, 2015 Author Share Posted April 7, 2015 rsrs. var e = document.getElementById("#animais"); var animais = e.options[e.selectedIndex].value; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now