I have a select, some options and a jquery code that does not change the select, updates the screen with the data of the chosen option. The question is, how do I maintain the option after the window.location? Note: I'm using Asp.Net
Code that I have:
View:
<select id="servicos">
@foreach (var i in servicos)
{
<option value="@Url.Content("~/servico/"+i.SiteInfoID+"/"+i.Titulo.html)">
@i.Titulo
</option>
}
</select>
Js:
function ComboServicos() {
$('#servicos').on('change', function () {
var url = $(this).val();
if (url) {
window.location = url;
}
return false;
});
}