1
I have a select, some options and a jquery code that in select change, updates the screen with the data of the chosen option. The question is, how do I maintain the option after window.Location? Obs: am using Asp.Net
Code 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;
});
}
You can go through querystring or save to the server, and then take this value and leave as selected with JS
– PauloHDSousa