I have a dropdown when user selects the option, the value is passed, but after the page refreshes i wanna retain the selected value(but now they are set to default) so user knows what was selected. Any hope.
i know this may be duplicate but i have not find any helpful answer in duplicate questions
My dropdown
<select id="Selection">
<option value="">Sort by</option>
<option value="0">Code</option>
<option value="1">Title A-Z</option>
<option value="2">Title Z-A</option>
<option value="3">Brand</option>
<option value="4">Lowest price</option>
<option value="5">Highest price</option>
<option value="6">Lowest Quantity</option>
<option value="7">Highest Quantity</option>
</select>
Jquery
$(document).ready(function () {
$("#Selection").change(function () {
var item = $(this).find(":selected").val();
$.ajax({
url: "/Cook/AddCookies",
data: { item: item },
type: 'POST',
// contentType: 'application/json; charset=utf-8',
success: function (data) {
// Variable data contains the data you get from the action method
}
});
});