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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:38:37+00:00 2026-05-16T01:38:37+00:00

hoping some one can shed some light on my problem. Basicly I only want

  • 0

hoping some one can shed some light on my problem. Basicly I only want to execute a block of code if a certain DOM element exists. If it does I then perform a few bits and bobs and then call a function. However it complains that the function is not defined, suggesting that the function is not in scope. Below is the code :

$(document).ready(function ()  
        {   
        if ((document.getElementById("view<portlet:namespace/>:editSplash")!= null)) {
        console.log("notifications scripted started");  

        // hide loading box/ notify on body load  
        $('.ajaxErrorBox').hide();
        $('.loadingNotifications').hide();
        $('.notifyWindow').hide();
        getFeed();

        // set up refresh button for reloading feed
        $('.refreshFeed').click(function() {
        $('.notifyWindow').hide();
        $('.notifyWindow').empty();
        console.log("notifications clicked");
        getFeed(); 
        });

    // begin ajax call using jquery ajax object 

    function getFeed ()
    {
    $('.notifyWindow').empty();  
    console.log("ajax call for feed starting");
        $.ajax ({
        type: "GET",
        url: "http://cw-pdevprt-05.tm-gnet.com:10040/notificationsweb/feed?username=uid=<%@ taglib uri="/WEB-INF/tld/engine.tld" prefix="wps" %><wps:user attribute="uid"/>",
        dataType: "text/xml",
        timeout: 10000,
        success: parseXml       
        });
        };

        // show loading box on start of ajax call

        $('.notifyWindow').ajaxStart(function() {
        $('.refreshFeed').hide("fast");
        $('.notifyWindow').hide();
        $('.ajaxErrorBox').hide();
        $('.loadingNotifications').show("fast");

        });

        // hide loading box after ajax call has stopped

        $('.notifyWindow').ajaxStop(function() {
        $('.loadingNotifications').hide("slow");
        $('.refreshFeed').show("fast"); 

        });

        $('.notifyWindow').ajaxError(function() {
        $('.loadingNotifications').hide("slow");
        $('.ajaxErrorBox').show("fast");
        $('.refreshFeed').show("fast"); 
        });  

    // parse the feed/ xml file and append results to notifications div

    function parseXml (xml) {
        console.log("xml parsing begining");        
        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.find("link").attr("href");
    var output = "<a href='" + linkN + "' target='_self'>" + title + "</a><br />";
    $(".notifyWindow").append($(output)).show();

    });
    }



        }
else {
    console.log("notifications not available");
    return false;
}

}); 

If the DOM element exists I then try and call the getFeed function “getFeed();” however it comes back undefined. If anyone could shed some light on this it would be greatly appreciated.

Thanks in advance

  • 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-16T01:38:38+00:00Added an answer on May 16, 2026 at 1:38 am

    Problem solved – I moved my functions outside of the if statement. We live and learn lol 🙂

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

Sidebar

Related Questions

Hoping someone can shed some light on this. I have a PHP program which
I am hoping someone can shed some light on this issue for me... I
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
We have an interesting problem that I was hoping someone could help to shed
Hoping someone can provide an answer with this, although it's not 100% programming related.
I'm hoping someone can clarify this behavior for me, and explain how ASP.NET is
I got a little stuck and I'm hoping someone can point me in the
As a follow-up to this question I am hoping someone can help with the
I've run into a really strange bug, that I'm hoping someone can explain. I
I've never been much for math and I'm hoping that someone can help me

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.