javascript - Function scope within IF Statement -


Hopefully someone can put some light on my problem. Basically I just want to execute blocks of code if a certain DOM Element exists. If this happens then I do some bits and Bobs and call the function. Although it complains that the function is not defined, it indicates that the function is not scope. The code below is:

  $ (document) .ready (function () {if ((document.getElementById ("view & lt; portlet: namespace / & gt;: editSplash") = null ) Console.log ("Notifications start scripting"); // Loop loading box / body weight $ ('. AjaxErrorBox') notify hide (); $ ('loading.Notifications'). Hide (); $ $ '('. NotifyWindow '). $ (' NotifyWindow '). $ (('. NotifyWindow ') Empty (); console.log ("Notifications Click"); getFeed ();}); // Start AJAX call jquery ajax object function getFeed ($ 'notifyWindow'). (); Console.log ("Ajax call to start feed"); $ .aex ({type: "GET", url: "http : //cw-pdevprt-05.tm-gnet.com: 10040 / notificationsweb / feed? Username = uid = & lt;% @ taglib Uri = "/ WEB-INF / tld / engine.tld" pref Ix = "wps"%> & lt; wps: user attribute = "uid" />, data type: "text / xml", Timeout: 10000, success: parseXml}); $ ('. NotifyWindow') $ ('NotifyWindow') .Jaxstart (function () {$ ('Refresh Feed'); $ ('. AjaxErrorBox') Wrap (); $ ('Loading notification'). Show ("fast");}); // $ ('RefreshFeed'). ("Refresh"). ("Notified") .jexostop (function () {$ ('loading notification'). Fast ");}); $ ('. NotifyWindow'). AjaxError ($ ('loading notification'). Hide ("slow"); $ ('. AjaxErrorBox') Show ("Fast"); $ ('RefreshFeed'). Show ("Fast") ;}); // Parse the feed / XML file and add notifications to the deval function paraxmal {XML} {console.log ("XML Parsing Beginners"); If (jQuery.browser.msie) {var xmlDoc = New ActiveXObject ("Microsoft.XMLDOM"); XmlDoc.loadXML (xml); Xml = xmlDoc; } $ (Xml) .find ("Entry"). Each (function () {var $ item = $ (this); var title = $ item.find ("title"). Text (); var linkN = $ item ARTR ("href"); var output = "& lt ; A href = '"+ linkN +' 'target =' _self '& gt;" + title + "& lt; / a & gt; & lt; br / & gt;" $ (". NotifyWindow") Attachments ($ (output)). Show ();});}} Else {console.log ("notifications are not available"); Details are false;}});  

If I have a DOM element, then I try and getFeed function "getFeed ();" However it is necessary to come back. If someone puts some light on it, then it will be highly appreciated

Advance money Thanks

It seems that before you define getFeed Try to move the if if statement afterwards. Note that this behavior is actually implementation specific, so some browsers can work in this way and nothing else.

Oh - and seriously? Id


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -