I've an Ajax call that write a dynamic Url for some product.
$("#Scheda").html( '<a href="/Frutta_e_Verdura/SchedaProdotto?idProdotto=' + result.Idprodotto + '&nome=' + result.Title + '" target = "_blank" >Scopri di più sul prodotto >>></a>' );
The result link is :
Frutta_e_Verdura/SchedaProdotto?idProdotto=83&nome=anacardi
I want turn it with routeconfig in the form:
Frutta_e_Verdura/SchedaProdotto/anacardi
I am trying with this routeconfig:
routes.MapRoute(
name: "prodotti",
url: "frutta_e_verdura/schedaprodotto/{nome}/{idprodotto}",
defaults: new { controller = "frutta_e_verdura", action = "Index", nome = UrlParameter.Optional ,idprodotto = UrlParameter.Optional }
);
How can i do this?
Thank you all for your availability