Hello
my question is an exact replica of ASP.NET MVC Routing , Html.BeginForm ,
im posting again because the suggested solution doesnt work..
my View:
@using (@Html.BeginForm("Search", "Home",FormMethod.Get))
{
input name="q" id="q" type="text" class="ipt" />
@Html.DropDownList("SearchType", new SelectList(
new[] { "All Words", "Any Word", "ZipCode" }, ("All Words")))
input type="image" src="../../Content/images/search.png" />
}
(i’ve removed < character so it shows in the question)
the generated url is this http://localhost:4893/Home/Search?q=Brabant&SearchType=ZipCode&x=51&y=5, i want it to be Home/Search/Brabant/ZipCode
EDIT :
i dont think it has something to do with routes, the javascript doesnt work! my problem is generating the url in first place, not matching it.
$('form').submit(function () {
var data = $('input[name="q"]', this).val();
window.location.href = this.action + '/' + encodeURIComponent(data);
return false;
});
The javascript has to be inside the form