Home > DeveloperSection > Forums > Loading Screen During Ajax Call
Ankit Singh

Total Post:341

Posted on    November-26-2015 10:35 PM

 AJAX ASP.Net  AJAX  JQuery 

 1 Reply(s)
 1315  View(s)
Rate this:
I want to use Loading Screen During Ajax Call in asp.net please help me

aditya kumar Patel

Total Post:254

Posted on    November-26-2015 10:37 PM

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxLoder.aspx.cs" Inherits="Forumasp.AjaxLoder" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-2.1.4.js"></script>
    <form id="form1" runat="server">
            $(function () {
                    type: "POST",
                    beforeSend: function (msg) {
                        $('#loader').show()      //start loading screen;
                    url: "AjaxLoder.aspx/GetData",
                    data: {},
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    asnyc: false,
                    complete: function () {
                        $('#loader').hide();  //end loading screen;
                    success: function (data) {

        <div id="data" style="width:500px;">
             <div id="loader"style="top:0.5%;right:30%;left:43%;font-size:large; color:#F7F7F7;position:fixed; display:none;">       
<img src="Images/ajax-loader.gif" /><br />

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Forumasp
    public partial class AjaxLoder : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)


        public static string GetData()
            string data = "You could try the same unordered query 100,000 times and always receive it with the same ordering, and thus come to believe you can rely on said ordering. But that would be a mistake, because one day, something will change and it will not have the order you expect. One example is when a database is upgraded to a new version of SQL Server--this has caused many a query to change its ordering. But it doesn't have to be that big a change. Something as little as adding or removing an index can cause differences. And more: Installing a service pack. Partitioning a table. Creating an indexed view that includes the table in question. Reaching some tipping point where a scan is chosen instead of a seek. And so on";
            return data;

Show loader before Loading Data:


Modified On Nov-26-2015 11:04:20 PM

Don't want to miss updates? Please click the below button!

Follow MindStick