Invoke an AsyncController Action from within another Controller Action?
- by Luis
Hi, I'd like to accomplish the following:
class SearchController : AsyncController
{
public ActionResult Index(string query)
{
if(!isCached(query))
{
// here I want to asynchronously invoke the Search action
}
else
{
ViewData["results"] = Cache.Get("results");
}
return View();
}
public void SearchAsync()
{
// some work
Cache.Add("results", result);
}
}
I'm planning to make an AJAX 'ping' from the client in order to know when the results are available, and then display them.
But I don't know how to invoke the asynchronous Action in an asynchronous way!
Thank you very much.
Luis