One of the great things about ASP.NET MVC is the routing engine. I love to generate my urls and not having anything break when I change the routes.
However, I'm not sure how I can apply this mechanism on the client side.
Let's imagine a common scenario where I have two dropdown lists and the content of the second list depends on the selected item in the first list. I want to load the items of the second list asynchronously, when the selection in the first list changes.
The URL, using the default route, could look like this : /Cars/GetModelsForBrand/Honda
Easy enough...
var url = '/Cars/GetModelsForBrand/' + $("#brands").val();
What if I change the routing and the url becomes : /Honda/GetModels
I just broke my code in an non-obvious way.
Is there any way to generate urls from the client side ?