Im trying to open modal in specific path using asp.net mvc 4 + jquery, heres the code:
Card.cshtml
<div class="btn-group">
<button class="btn btn-primary openModal" data-path="/Client/Edit/@Model.ClientID">Editar</button>
<button class="btn btn-primary openModal" data-path="/Client/Products/@Model.ClientID">Products</button>
</div>
then in modal.js
$(document).on('click', '.openModal', function () {
var path = $(this).attr("data-path");
$("#modal").load(path, function () {
$("#modal").modal();
})
});
in ClientController
public ActionResult Edit(long id = 0)
{
Client client = db.Clients.Find(id);
if (client == null)
{
return HttpNotFound();
}
return View(client);
}
public ActionResult Products(long clientID)
{
return View(db.Products.Where(p => p.ClientID == clientID).ToList());
}
The Edit action works, but the Products action not (i put a breakpoint and its not called). Whats wrong?