views:

42

answers:

2

I've got a feeling this is going to be something really simple, but anyway. I've got some code that pulls in my latest Twitter statuses - it's pretty much the standard code everyone is using. However, even though the URL I'm using has the count parameter added...it's not limiting the request to 5 statuses. The code works, well, in so much as it will output 20 statuses instead, just as its set to by default, but I can't get it to limit the number. What have I done wrong? (I've simplified the output down to a body append just to make things easier)

$(document).ready(function(){

var username = 'Mynamewouldbehere';
var format = 'json';
var url = 'http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?&count=5';





$.ajax({  
    url : url,
    dataType : "json",  
    timeout:15000,  

    success : function(data)  
    {
             $.each(data, function(i,item){

             $("body").append('<p>'+item.text+'</p>');



            })


    }


});  

})

A: 

Without the 'callback=?' argument it works as expected.

ingorichter
+3  A: 

Use & instead of &amp; in the URL. Your code is currently creating a parameter named amp;count instead of count.

interjay
Thanks interjay, that fixed it...and don't I ever feel stupid!*Hangs head in shame*
Kerry