Why is the option select incorrectly selected when sending ajax?
-
There is a select with options
<select id="sel"> <option value="1">опция 1</option> <option value="2">Опция 2</option> <option value="3">Опция 3</option> </select>
$.ajax({ type: "POST", url: "/url/", data: {sel:$("#sel").val()}, }
On the server side, for some reason, regardless of which option is selected, only the value of the first comes to the select. How do I get the correct value for the select?AJAX Emerson Sanders, Dec 2, 2020 -
$('.sel').change(function(){
// тут получаете значение option и в ajax его
})Hunter McKee
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!