0

Right now I'm trying to get multiple callbacks from a single feed, however I keep getting "val parameter is undefined"

Here is the code:

var m,i=100,s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],b=["#","@","http","www","tweet","twit","Twit","TWIT","tweep","blog","text","follower","Follower","Text","Twee","txt",".ly","follow",".com",".COM",".net","yahoo",".org"," DM"," RT","RT:"];
var count = 0;
var rand;
u=function() {
    if (i--<1) {
        location.reload();
        return false;
    }
    document.getElementById('w').innerHTML = "<h2><font color =\"red\">Error :(</font></h2>" ;

    while (typeof(w[i]) === "undefined" || typeof(w[i]) === "" || typeof(w[i]) === " " || typeof(w[i]) === null){
        rand = Math.floor((Math.random()*100)+1);
        if (typeof(w[rand]) === "undefined"){
            rand = Math.floor((Math.random()*100)+1);
            document.getElementById('w').innerHTML =  w[rand].text ;
            break;
        }
        else {
            document.getElementById('w').innerHTML =  w[rand].text ;
            break;
        }
        count++;
        if (count == 3){
            document.getElementById('w').innerHTML = 'Error 404' ;
            u();
            break;
        }
    }
    document.getElementById('w').innerHTML =  w[i].text ;
    document.getElementById('qr').innerHTML = qr[i].val; //<<THis is where the error occurs
};
r=function(data,data2) {
    w=data['results'];
    qr=data2['since_id'];//The error also occurs here accordingly
};

Any help is very appreciated!

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by AleMonteiro
0

The code you posted isn't complete, I can't test it as it is. Please post something that can be tested.

And by the way, where is 'w' and 'qr' defined?

0

w and qr are just identifiers in the html
<span id="w"></span> and so on.

The feed also is in the html:
<script type="text/javascript" src="HTTPS://search.twitter.com/search.json?lang=en&q=obama&rpp=100&callback=r"></script>

Then the identifiers are placed where I want them to be. W shows up just fine, however qr says unidentified.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.