How can I make a preloader (loading ...) while it is rendering the view in @RenderBody
?
In search I just found examples using Partial, but Views not
Any ideas?
How can I make a preloader (loading ...) while it is rendering the view in @RenderBody
?
In search I just found examples using Partial, but Views not
Any ideas?
There is not much secret:
public JsonResult MinhaAction(int id)
{
// Preenchimento de 'meuJson', e tal
return Json(meuJson);
}
I'm using jQuery, and assuming you've already found a "loading" screen somewhere. I'm going to assume it stays inside a <div>
whose Id is "loading":
$('#meuLink').click(function()
{
var action = '@Html.ResolveUrl("~/MeuController/MinhaAction/")' + $('#campoId').val();
$('#carregando').show()
$.getJSON(action, null, function(variavelDeCallback)
{
// Faça aqui o que precisa com 'meuJson'
$('#carregando').hide()
});
});