jquery - What does this do: ($(":not(script)", destination).length == 0) -


Resolved: line destination.block (...) is one which causes errors. I have emptied the empty ones to avoid this. I think if the (empty) statement is just picking between two different ways of displaying a busy message.

I'm new to jQuery and an ASP.NET MVC 2 project from a former colleague I am struggling to understand what the following line of code is doing:

  var empty = ($ (": no (script)", destination). Length == 0);  

This row has causes and errors in IE, but not in Firefox. To look honest on the given below function, I do not think it is required, but as my colleague did not believe in commenting on his code. I have to understand the effect of changing the code. The reference to the above is the following Javascript function:

  PRISMbase.LoadPartialEx = function (URL, data, destination, success callback, loading message, appendo overwrite) {var Empty = ($ (": (no script)", destination). Length == 0); Var message = loading message == empty? "Please wait": Loading message; If (empty) destination.html (busy); Other destination. Block ({Message: ' "+ Message +' & lt; / h1 & gt; '}); Return $ .ajax ({data: data, data type: "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);} and destination.empty (); if (successClallback! =) Zero) Success callback (destination, partial);}}); }  

In the above:

Destination = A jQuery selector is returning "#TabContent" (this is a div).

busy = ' & lt; Img class = "progress" src = "/ content / onyxprogresscircle.gif" /> ';

Any help would be appreciated.

Thank you.

This line of code contains all non-script tags that are present within the destination selector and then check that the found elements Whether the number is 0 or not. The variable empty should end in boolean value. How to read the error in IE?

It can also say that empty returns from jQuery will evaluate the wrong, so you can possibly do something like this:

  if ($ (': (no script '), Destination)) destination.block ({Message:'  "+ Message + '& lt; / h1 & gt;'}); Else destination.html (Busy);  

Keep reversal in order. In the original, $ (": no (script)", destination). Length == 0 returns true when there are no elements in mine, we are not collecting boolean separately, we are working on jQuery based on initial return , So there is no element false result.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -