Skip to content Skip to sidebar Skip to footer

Show Loading Image After Click Button And Page Load

i got a problem in my project. I have 2 webpage, webpage xxx for the input and webpage yyy for the output. the processing time is taking 2 mins, so after i clicked the button on we

Solution 1:

Try this:

<divclass="ui-widget-overlay"><divid="loadingDivId"><imgsrc="~/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");elsealert("not success")}});}

public JsonResult GenerateReport(){System.Collections.Specialized.NameValueCollection collections = newSystem.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"