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!

Recommended Answers

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?

Jump to Post

But if 'qr' is defined on the html, what qr[i].val is supposed to be?

Jump to Post

All 5 Replies

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?

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.

But if 'qr' is defined on the html, what qr[i].val is supposed to be?

Qr[i].val returns the max_ID, or at least should.

How it should do that? Where it's that array defined?

Please, post your complete code that can be tested.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.