MVC Redirect to View from jQuery with parameters

Viewed 112082

I have seen some posts relating to this but can't seem to get it to work. With the redirect I get a 'resource cannot be found error'.

I am trying to redirect to a Details page. There is an ID in element which I store as NestId that I want to eventually be able to pass to the View. Right now I just want to redirect to the details page, there isn't a model or anything attached to it. I just want the NestId to make it there so that I can use it to make more AJAX calls with it.

Here is my jQuery:

$('#results').on('click', '.item', function () {
            var NestId = $(this).data('id');
            var url = '@Url.Action("Details, Artists")'; 
            window.location.href = url; 
        })

Here is the function on the Controller:

public ActionResult Details(string NestId)
    {
        ViewBag.NestId = NestId; 
        return View();
    }

I'm not sure if I am going about this the right way but help would be appreciated, I've stalled on this for a while. Thanks!

4 Answers
Related