I have two Views.
Index
Assincrona
When accessing index
, it calls View Assincrona
and gets a gif loading until the whole page ( Assincrona
) is loaded and shows in View .
Controller Codes
public ActionResult Assincrona()
{
DateTime data = DateTime.Now;
mes = Convert.ToInt32(data.Month) - 2;
dadosCarteiraPGC(2016, mes, null);
return PartialView("Assincrona", carteiraPGC);
}
public ActionResult Index()
{
return View();
}
View Codes
<div class="partialContents" data-url="/Consulta/Assincrona">
<div class="mensagem"><img src="~/Images/indicator.white.gif"/><p>Carregando ... </p></div>
</div>
JS Codes
var site = site || {};
site.baseUrl = site.baseUrl || "";
$(document).ready(function (e) {
$(".partialContents").each(function(index, item) {
var url = site.baseUrl + $(item).data("url");
if (url && url.length > 0 ) {
$(item).load(url);
}
});
$("a.nav").click(function() {
$("body").html("");
});
});
It's working fine until I need to receive data via post.
I get the value of the month via [HttpPost]Index
, but I can not get to Assincrona
when it is called via View .
Would using TempData[]
be a good way to solve this problem or is there another way to do it?