3
I have two Views.
Index
Assincrona
When access to index
, he calls the View Assincrona
and there’s a gif uploading to the whole page (Assincrona
) be loaded and displayed 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 perfect until I need to receive data via post.
I recover the value of the month via [HttpPost]Index
, but I can’t get through to Assincrona
when she is called via View.
Use TempData[]
would be a good way to solve that problem or is there another way to do?