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 988943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:42:42+00:00 2026-05-16T05:42:42+00:00

RESOLVED: The line destination.block(…) is the one causing the errors. I’ve forcing empty to

  • 0

RESOLVED:
The line destination.block(…) is the one causing the errors. I’ve forcing empty to equal true to avoid this. I think that the if (empty) statement is just picking between two different ways of displaying a busy message.

I’m new to jQuery and have taken over maintaining an ASP.NET MVC 2 project from an ex-colleague. I’m struggling to understand what the following line of code is doing:

var empty = ($(":not(script)", destination).length == 0);

This line causes and error in IE but not in Firefox. To be honest looking at the function below I don’t think it’s needed, but as my colleague did not believe in commenting his code. I need to understand the impact of changing the code. The context for the above is the following Javascript function:

PRISMbase.LoadPartialEx = function(url, data, destination, successCallback, loadingMessage, appendNotOverwrite) {
    var empty = ($(":not(script)", destination).length == 0);
    var message = loadingMessage == null ? "Please wait" : loadingMessage;
    if (empty)
        destination.html(busy);
    else
        destination.block({ message: '<h1 class="Progress">' + message + '</h1>' });

    return $.ajax({
        data: data,
        dataType: "html", type: "GET", url: url,
        success: function(viewHtml) {
            var partial = $(viewHtml);
            if (!empty)
                destination.unblock();

            if(viewHtml != "")
            {
                if (appendNotOverwrite)
                    destination.append(partial);
                else
                    destination.html(partial);

                PRISMbase.InitialiseFormElements(destination);
            }
            else
                destination.empty();

            if (successCallback != null) successCallback(destination, partial);
        }
    });
}

In the above:

destination = a jQuery selector returning “#TabContent” (this is a div).

busy =’<img class="progress" src="/Content/OnyxProgressCircle.gif" />‘;

Any help would be appreciated.

Thanks.

Alan

  • 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-16T05:42:43+00:00Added an answer on May 16, 2026 at 5:42 am

    That line of code is retrieving all of the non-script tags that exist inside of the destination selector and then testing for whether or not the number of found elements is 0. The variable empty should end up as a Boolean value. How does the error read in IE?

    It might also be worth pointing out that an empty return from jQuery will evaluate false, so you could probably do something like this:

    if ($(':not(script)', destination))
        destination.block({ message: '<h1 class="Progress">' + message + '</h1>' });
    else
        destination.html(busy);
    

    Be sure to notice the reversal in the order. In the original, $(":not(script)", destination).length == 0 gives true when there are no elements. In mine, we’re not storing that Boolean separately, we’re operating based on the initial return from jQuery, so no elements is the false result.

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

Sidebar

Related Questions

Problem resolved, I forgot to add this line: myWebView.getSettings().setJavaScriptEnabled(true); I havew a WebView with
I read this typedef line in a C++ book, but I couldn't resolve its
* Resolved * I implemented SimpleCart(js) to my one project. One can register and
I resolved this issue myself. It turns out that the activation framework requires some
I thought I had resolved this but I obviously haven't and was hoping someone
This was resolved. The statement was in another part of the stored procedure. The
Why this line doesn't work? import static java.nio.file.AccessMode.*; Eclipse says: The import java.nio.file cannot
I am getting a cannot be resolved error when I try to do this:
I'm trying to get this resolved in .NET 2.0 and unfortunately that is not
Possible Duplicate: R cannot be resolved - Android error The errors I have are

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.