jquery - Get value of a select element with ajax -


i'm trying value of select element, returning array()

this html:

<select name="data[attorney][empresa]" id="attorneyempresa">     <option value="">selecione</option>     <option value="3">sotreq</option> </select> 

and jquery:

$(document).ready(function() {     $("#attorneyempresa").change(function(){         $.ajax({             type: 'post',             data: $('#attorneyempresa').val()         });     }); }); 

what's wrong?

try this

$(document).ready(function() {     $("#attorneyempresa").change(function(){         $.ajax({             type: 'post',             data:  {keyname:$('#attorneyempresa option:selected').val()}         });     }); }); 

demo


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -