Reputation: 85
I am trying to send data and change view. I put breakpoint, second view worked but not show to me. I don't want to use Html.BeginForm
because I am working with hmtl and javacript.
public ActionResult Second(int id)
{
List<Properties> users = GetData(id);
return View(users);
}
$('select').on('change', function (e) {
//var id = $(this).find(":selected").val()
var id = this.selectedIndex;
var targetUrl = '/Home/Second/' + id.toString();
$(this).load(targetUrl);
});
Upvotes: 1
Views: 1981
Reputation: 85
I Fix that
$('select').on('change', function (e) {
var id = this.selectedIndex;
var targetUrl = '/Home/Second/' + id.toString();
location.href = targetUrl;
});
Upvotes: 1