Show Loading Image After Click Button And Page Load
Solution 1:
Try this:
<div class="ui-widget-overlay">
<div id="loadingDivId">
<img src="~/Content/Images/loading.gif" />
</div>
</div>
function DisablePage() {
$('.ui-widget-overlay').css('height', '100%');
}
function EnablePage() {
$('.ui-widget-overlay').css('height', '0%');
}
$(document).ajaxStart(function () {
DisablePage();
});
$(document).ajaxStop(function () {
EnablePage();
Redirect to yyy
});
function GenerarteReport() {
var url = urlHelper.CommonHelper("", "Home", "GenerateReport");
$.ajax({
url: url,
dataType: "json",
ype: "GET",
contentType: 'application/json; charset=utf-8',
async: true,
processData: false,
cache: false,
success: function (data) {
if(data.success)
alert("success");
else
alert("not success")
}
});
}
public JsonResult GenerateReport()
{
System.Collections.Specialized.NameValueCollection collections = new
System.Collections.Specialized.NameValueCollection();
collections.Add("ID", Session["ID"].ToString());
string remoteUrl = "WebfrmReport.aspx";
string html = "<html><head>";
html += "</head><body onload='document.forms[0].submit()'>";
html += string.Format("<form name='PostForm' method='POST' action='{0}' style='display:none;'>", remoteUrl);
foreach (string key in collections.Keys)
{
html += string.Format("<input name='{0}' type='text' value='{1}'>", key, collections[key]);
}
html += "</form></body></html>";
Response.Clear();
Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-1");
Response.HeaderEncoding = Encoding.GetEncoding("ISO-8859-1");
Response.Charset = "ISO-8859-1";
Response.Write(html);
Response.End();
return Json(new { success = true }, JsonRequestBehavior.AllowGet);
}
Post a Comment for "Show Loading Image After Click Button And Page Load"