You are not subscribing to any successful callback in your $ .post AJAX call. This means the query is running, but you are not doing anything with the results. If you want to do something useful with the results, try:
$.post('/Branch/Details/' + id, function(result) {
On the other hand, if you want to redirect, you absolutely do not need AJAX. You use AJAX only when you want to stay on one page and update only part of it.
So, if you only want to redirect the browser:
function foo(id) { window.location.href = '/Branch/Details/' + id; }
As a side note: You should never hardcode URLs. You should always use URL helpers when working with URLs in an ASP.NET MVC application. So:
function foo(id) { var url = '@Url.Action("Details", "Branch", new { id = "__id__" })'; window.location.href = url.replace('__id__', id); }
Darin Dimitrov Nov 16 '11 at 8:26 2011-11-16 08:26
source share