I'm quite a newbie when it comes to jquery. I'm using cakePHP and I have a form to register orders for a selected user, the select input for selecting the user looks like this in cakePHP:
echo $this->Form->input('user_id');
and that renders a form with an input like this:
<label for="OrderUserId">User</label>
<select name="data[Order][user_id]" id="OrderUserId">
<option value="2"> User 2</option>
<option value="3"> User 3</option>
</select>
I want to do an ajax call so that, when a user is selected, his info appears in a div. So far, I have this javascript:
$(document).ready(function(){
$("#OrderUserId").change(function() {
$.ajax({
url: 'users/getData' //here would go the user ID
});
});
});
My question is this: how can I get the value of the selected option with jQuery so that I can pass it to the url in the ajax method?