Announcement

Collapse
No announcement yet.

javascript feed errors showing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • javascript feed errors showing

    I have been successfully using Javascript feeds to display thread titles with links on an HTML index page (what I call Frontpage) from/to a couple of forums.

    I have noticed an error warning showing in the status bar in IE6 when the index page loads. This did not prevent the index page loading okay and showing the JS thread links. Firefox does not show the errors. However, with IE7, the JS links do not appear on the HTML page. The optional popup message giving error detail says:

    "threads[...].threadid is null or is not an object"

    The JS code on the HTML page is:

    for (x = 0; x < 4; x++)
    {
    document.writeln("<a href=\"oracle/showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+" <br><br />");
    }



    As my knowledge of JS coding is limited, could someone please suggest a solution to this problem - is there an error in the script?

  • #2
    You're forcing an iteration of 4 loops. I would guess that less than 4 threads are being returned. You should change the code to:

    Code:
    for (x in threads)
    {
        document.writeln("<a href=\"oracle/showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+" <br><br />");
    }
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment


    • #3
      Thanks for this Wayne.

      This code has been working for over a year returning any number of threads in a designated forum between x=0 (the last and newest posted) to x=n. In fact, the second forum js code on the HTML index page returns 15 thread titles with x=15. So I am unsure what you mean here.

      The code I have used was taken from a Vbulletin forum thread (but having trouble finding it to give reference to it).

      You can find our site to see the results (all browsers except IE7) at:

      http://www.audio-oracle.com

      You will see the returned links in the RHS two columns (Newscast and Active)

      Could you expand on your answer please?

      Regards
      Last edited by Profaders; Wed 11 Jul '07, 12:05pm. Reason: typo

      Comment


      • #4
        The error is caused by an object not being available. In this case the threads array at location [x].

        So either it isn't reading the external.php feed at all or you have a hardcoded limit which exceeds the amount of data available. The bit of javascript I provided prevents the second scenario from happening.
        Translations provided by Google.

        Wayne Luke
        The Rabid Badger - a vBulletin Cloud demonstration site.
        vBulletin 5 API

        Comment


        • #5
          Thanks for the suggestion. This indeed gets rid of one error only to be replaced by another. IE6 now shows no errors, although I have lost the ability to limit the number of threads I have returned.

          However, the scary thing is that IE7 still does not return the JS feeds (displays the two thread lists) to the HTML page. Error showing is:

          "Thread is undefined"
          "Syntax Error"

          Given I have tried other combinations of suggested code as found here in the community, I am now thinking of abandoning the idea of using JS feeds into HTML.

          Is it just my browser and just me (hopefully) or is this a problem across IE7 generally. Perhaps some members can browse my site using IE7 to report back - it would be appreciated. See post #3 for location.

          Regards

          Comment


          • #6
            I am using Internet Explorer 7 and see the feeds in the two columns on the right. I also don't get any errors on the page.

            To limit the above code you could do:
            Code:
            for (x in threads)
            {
                if (x == 4) {break;}
                document.writeln("<a href=\"oracle/showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+" <br><br />");
            }
            Translations provided by Google.

            Wayne Luke
            The Rabid Badger - a vBulletin Cloud demonstration site.
            vBulletin 5 API

            Comment


            • #7
              Yes, thanks for your help Wayne.

              That appears to have fixed the issues, although I still have problems with my version of IE7 - though others have confirmed they can see the JS feeds returned without error. It's probably not refreshing for some reason. And yes, I have got Javascript switched on

              You might be interested in looking at this thread about JS feed coding, as the code is very simialr to the version I had, which was creating errors...

              http://www.vbulletin.com/forum/showthread.php?t=180409

              Regards
              Last edited by Profaders; Fri 13 Jul '07, 9:08am. Reason: link added

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...
              X