---
title: "Loading Screen During Ajax Call"  
description: "Loading Screen During Ajax Call"  
author: "Anonymous User"  
published: 2015-11-26  
updated: 2015-11-26  
canonical: https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call  
category: "ajax"  
tags: ["asp.net", "ajax", "jquery"]  
reading_time: 2 minutes  

---

# Loading Screen During Ajax Call

I want to use [Loading Screen](https://answers.mindstick.com/qa/115759/reddit-app-stuck-on-loading-screen-how-to-fix) During [Ajax](https://www.mindstick.com/articles/1541/check-availability-of-user-name-or-email-using-asp-dot-net-ajax-and-jquery) Call in [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) please help me

## Replies

### Reply by Anonymous User

```
<%@ 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">    <title></title>    <script src="Scripts/jquery-2.1.4.js"></script></head><body>    <form id="form1" runat="server">        <script>            $(function () {                $.ajax({                    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) {                        console.log(data['d']);                        $('#data').html(data['d']);                    }                })            });        </script>    <div>        <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 />        loading...  </div>         </div>        </div>    </form></body></html>
```

```
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)        {        }        [WebMethod]        public static string GetData()        {            System.Threading.Thread.Sleep(5000);            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:**![Loading Screen During Ajax Call](https://www.mindstick.com/mindstickforums/2e235e9c-92e3-4301-9b75-8780ca2d0374/images/e7962e35-f437-4e86-b154-1b092be2c937.png)

**Result:**![Loading Screen During Ajax Call](https://www.mindstick.com/mindstickforums/2e235e9c-92e3-4301-9b75-8780ca2d0374/images/9a337d24-b1a9-4168-aac3-41e5787895a0.png)


---

Original Source: https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
