Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:43:59+00:00 2026-05-29T19:43:59+00:00

Folks, I have ASP.NET MVC 3 Application and I have the following JQuery script

  • 0

Folks,

I have ASP.NET MVC 3 Application and I have the following JQuery script below to show modal pop up windows. The following script is able to show modal dialog. However, I would like to load loading icon while the modal dialog is opening. do you have any idea how can I do it?

<%= Html.ActionLink("Details", "ProductShipping", "OnlineStore", new { ProductGUID = Html.Encode(Model.GUID) }, new { @class = "EditShippinglink", title = "Edit Product Shipping", data_dialog_id = "EditProductShipping", data_dialog_title = "Shipping Method" })%>

JQuery

$(".EditShippinglink").live("click", function (e) {
            $.ajaxSetup({ cache: false });
            e.preventDefault();
            var $loading = $('<img src="/Content/ajax-loader.gif" alt="loading" class="ui-loading-icon">');
            $("<div></div>")
                    .addClass("dialog")
                    .attr("id", $(this)
                    .attr("data-dialog-id"))
                    .appendTo("body")
                    .dialog({
                        title: $(this).attr("data-dialog-title"),
                        close: function () { $(this).remove() },
                        width: 900,
                        modal: true,
                        minHeight: 500,
                        show: 'fade',
                        hide: 'fade',
                        resizable: 'false'
                    })
                    .load(this.href);
        });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:44:02+00:00Added an answer on May 29, 2026 at 7:44 pm

    Set the initial HTML of the modal dialog to be what you want to show until the ajax request completes and changes the content of the popup’s window.

    Rather than having an empty div to start with, $('<div></div>'), use a div that is loaded with the html you want to show while the load is occurring.

    @Html.ActionLink("Item Details", "Details", "Home", new { id = 1 }, new { @class = "EditShippinglink", title = "Edit Product Shipping", data_dialog_title = "Shipping Method" })
    <div id="my-dialog" style="display:none;">
        <div id="my-dialog-content"></div>
        <div id="my-dialog-progress" style="display:none;"><img src="@Url.Content("~/Content/ajax-loader.gif")" alt="loading" class="ui-loading-icon"></div>
    </div>
    
    <script type="text/javascript">
        var theDialog = $('#my-dialog').dialog({
            autoOpen: false,
            modal: true,
            closeOnEscape: false,
            width: 900,
            modal: true,
            minHeight: 500,
            show: 'fade',
            hide: 'fade',
            resizable: 'false'
        });
        var myDialogProgress = $('#my-dialog-progress');
        var myDialogContent = $('#my-dialog-content');
        $(".EditShippinglink").on("click", function (e) {
            $.ajaxSetup({ cache: false });
            e.preventDefault();
    
            myDialogProgress.show();
            theDialog.dialog('open');
            theDialog.dialog('option', 'title', $(this).attr("data-dialog-title"));
    
            //clear content before showing again
            myDialogContent.html('');
    
            $.ajax({
                type: 'get',
                url: this.href,
                dataType: 'html',
                error: function (jqXHR, textStatus, errorThrown) {
                    //do something about the error
                },
                success: function (data) {
                    //hide the progress spinner and show the html
                    myDialogProgress.hide();
                    myDialogContent.html(data);
                },
                complete: function () {
                    //do some other completion maintenance
                }
            });
        });
    
    </script>
    

    Then when the dialog is shown but still waiting for the load to complete, the loading gif will be shown. Once the operation is complete, the load will overwrite the animated loading gif html.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have been building websites using vs 2008 (mostly asp.net mvc, jquery and webforms).
Curious whether folks have setup 2 way transactional replication on the tables ASP.NET uses
I have a requirement for a set of asp.net MVC websites as follows: Multiple
I have been learning ASP.NET MVC in the last few months and I think
Folks, I'm doing remote validation in an ASP.NET MVC 3 context. Sometimes it doesn't
In my web app (ASP.NET MVC), I send an email using the following: MailMessage
I have an ASP.NET 4 application that has been in production for years running
I have an intranet ASP.NET web application in which I need to get the
Folks, I have an ASP.NET project which is pretty n-tier, by namespace, but I
Folks, I have a problem. I am a writing a script in python which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.