I have an Asp.net MVC partial view that is used for searching. It does an Ajax call to retrieve results. Once the results are retrieved and displayed in the result pane, the user can click on a link in any of the result rows to select one of the search results. When the user clicks on a link to select one of the search results, it will make an Ajax post request to update some state. Once this Ajax call is complete, I need to redirect to another page, but the destination page depends on which page the user is on. This search partial view will be hosted in multiple pages and the redirect location will be different for each of the host pages. I cannot think of a way to do this that makes sense and doesn't couple the partial view to the hosting page (or vice versa) excessively.
I guess the other option might be to redirect to another page once the selection Ajax call is complete (this is ultimately the goal), but won't a redirect result within an Ajax call get swallowed?
Or is there a way to have a button or link on each row instead that causes a post request to occur that could return a redirect result, with the destination based on the calling page?