Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat does this do: ($(":not(script)", destination).length == 0)
    primarykey
    data
    text
    <p><strong>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.</strong></p> <p>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:</p> <pre><code>var empty = ($(":not(script)", destination).length == 0); </code></pre> <p>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:</p> <pre><code>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: '&lt;h1 class="Progress"&gt;' + message + '&lt;/h1&gt;' }); 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); } }); } </code></pre> <p>In the above:</p> <p>destination = a jQuery selector returning "#TabContent" (this is a div).</p> <p>busy ='<code>&lt;img class="progress" src="/Content/OnyxProgressCircle.gif" /&gt;</code>';</p> <p>Any help would be appreciated.</p> <p>Thanks.</p> <p>Alan</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload