How to show "Loading..." in Jquery Ajax Call

Hi There,

Well, that's pretty simple now. Below is the sample code that you can customize according to your needs. It will show a smooth Loading... with jquery effect.

JQuery Code:

            $("#loading").fadeIn("slow");
            $.ajax({
                crossDomain: true,
                contentType: "application/json; charset=utf-8",
                url: "http://localhost:8080/Service.asmx/GetEmployessJSON",
                data: { UserName: GetUserName(), Month: Month, Year: Year }, // example of parameter being passed
                dataType: "jsonp",
                success: onDataReceived
            });

        function onDataReceived(data) {
            $("#loading").fadeOut();
            $("#myDiv").text(data.MyCustomProperty);
        }

HTML Code:

        <div id="loading" style="display: none;">
            Loading....
        </div>


Happy Coding :)

Comments

Popular Posts

GREYCstoration Oil Paint plugin for Photoshop

Apple iPhone sending SMS automatically 00447786205094

SharePoint online hub navigation not updating for other users

Service Bus Gateway service stuck at Starting

How to move SharePoint list items to a folder and subfolders in the same list using C# programmatically?