# Display a Loading Indicator over the Window

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Progress® Kendo UI® Window for jQuery</td>
 </tr>
 <tr>
  <td>Operating System</td>
  <td>Windows 10 64bit</td>
 </tr>
 <tr>
  <td>Visual Studio Version</td>
  <td>Visual Studio 2017</td>
 </tr>
 <tr>
  <td>Preferred Language</td>
  <td>JavaScript</td>
 </tr>
</table>

## Description

How can I display a [Kendo-UI-style loading indicator](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/ui/methods/progress) over the Window content area while (or before) a remote request is made?

## Solution

You need to display the loading overlay over the Window [`element`](https://www.telerik.com/kendo-jquery-ui/documentation/framework/widgets/wrapper-element) or some of its ancestors. This ensures that the overlay is removed automatically when the new content is loaded and rendered.

The following example demonstrates how to achieve the desired scenario.

```dojo
    <div id="example">
        <button id="showOverlay">Show overlay</button>
        <p>Click on the Refresh button to remove the overlay.</p>
        <p>In real-world scenarios the loading overlay will be removed automatically when the new content is rendered
            (e.g. when loaded with Ajax).</p>

        <div id="window"></div>

        <script>
        // Window initialization code start
        // when Kendo UI using server wrappers, the initialization script will be generated automatically
        $(function() {
            $("#window").kendoWindow({
                title: "Kendo UI Window",
                actions: ["refresh"],
                content: {
                    template: "Now is #= (new Date()).toLocaleTimeString() #"
                },
                width: 300,
                height: 160
            });
        });
        $("#showOverlay").kendoButton();
        // initialization code end

        // example code start
        $(function() {
            var windowWidget = $("#window").data("kendoWindow");

            $("#showOverlay").click(function(){
                kendo.ui.progress(windowWidget.element, true);
            });
        });
        </script>
    </div>
```

## See Also

* [Window JavaScript API Reference](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/window)
* [Add **Close** Button inside Modal Windows](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/add-close-button)
* [Cascade Open Windows](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/cascade-open-windows)
* [Post to Iframe](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/post-to-iframe)
* [Use Custom Action Icons](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/use-custom-action-icons)
