I am trying to pass a url with some parameters on a dropdown select input, I am calling a function with the onchange event.
The problem I having is that there are multiple dropdowns in the same page all utilizing a dropdown each. When I choose an option only the first select's value is being passed even if any select is chosen.
e.g.
<tr><td>
<select onchange="updateStatus();">
<option value="changed&id=771">Change</option>
<option value="posted&id=771">Posted</option>
</select>
</td></tr>
<tr><td>
<select onchange="updateStatus();">
<option value="changed&id=750">Change</option>
<option value="posted&id=750">Posted</option>
</select>
</td></tr>
And the Jquery function:
function updateStatus() {
$.ajax({
type: 'GET',
url: 'print.php',
data: {stat: $('select').val()},
success: function (data) {
alert('done');
}
})
}
I can see in my console that the data is being passed but always the first one's value.
What do I need to change so that it is the corresponding value and not always the first one? thanks in advance.
