QuestionCode issue, not showing on website.

Posts 1–4 of 4 · Page 1 of 1
Code issue, not showing on website.
Why doesn't the following code work!?

Code:
if($('#twitter_box').length){
		var yourTwitterUsername = "fishydesigns"; 
		 $.ajax({
			url : "http://twitter.com/statuses/user_timeline/"+yourTwitterUsername+".json?callback=?",
			dataType : "json",
			timeout: 15000,
			
			success : function(data){
				var list = $("<ul class='tweet_list'>");
				for (i=0; i<4; i++){
					list.append("<li>" + data[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url){
								return '<a href="'+url+'" target="_blank">'+url+'</a>'}) + "</li>");
                }
				$("#twitter_box").html(list);
				$(".oneOfThree, .twoOfThree").adjustHeight();
			},
		
			error : function(){
				$("#twitter_box").html("There was an error connecting to Twitter");
				$(".oneOfThree, .twoOfThree").adjustHeight();
			}
I'm not that great in Java script so yeah...
Quote Originally Posted by Web-Designer View Post
Why doesn't the following code work!?

Code:
if($('#twitter_box').length){
        var yourTwitterUsername = "fishydesigns"; 
         $.ajax({
            url : "http://twitter.com/statuses/user_timeline/"+yourTwitterUsername+".json?callback=?",
            dataType : "json",
            timeout: 15000,
            
            success : function(data){
                var list = $("<ul class='tweet_list'>");
                for (i=0; i<4; i++){
                    list.append("<li>" + data[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url){
                                return '<a href="'+url+'" target="_blank">'+url+'</a>'}) + "</li>");
                }
                $("#twitter_box").html(list);
                $(".oneOfThree, .twoOfThree").adjustHeight();
            },
        
            error : function(){
                $("#twitter_box").html("There was an error connecting to Twitter");
                $(".oneOfThree, .twoOfThree").adjustHeight();
            }
I'm not that great in Java script so yeah...
When you copy paste the code, this will happen...always !! Learn Javascript and then try again !!!
just to let you all know I got it figured out, it does work just I had to put the full url, inputing the username into it was what was messing it up....so it does work....


Although I doesn't know much about java, it took me little over an hour editing the code to get it to work. (I posted this 20-30mins after I couldn't get it.)
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?