title: Workaround to making an XMLHttpRequest to api.twitter.com?
body: <p>** <strong>UPDATE:</strong></p>
  
  <p>Apparently the problem morphed into an XMLHttpRequest problem:</p>
  
  <pre><code>XMLHttpRequest cannot load http://api.twitter.com/1/statuses/user_timeline.json?screen_name=bogdanch&amp;. Origin http://adfix.ro is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>The code I'm using is:</p>
  
  <pre><code>(function ($) {
      var Twitter = {
          init: function () {
              this.insertLatestTweets("bogdanch")
          },
          insertLatestTweets: function (a) {
              var b = 5;
              var c = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + a + "&amp;#038;count=" + b + "&amp;#038;callback=?";
              $.getJSON(c, function (b) {
                  var c = '&lt;marquee behavior="scroll" scrollamount="1" direction="left"&gt;';
                  for (var d in b) {
                      c += '&lt;a href="http://twitter.com/' + a + "#status_" + b[d].id_str + '"&gt;' + b[d].text + " &lt;i&gt;" + Twitter.daysAgo(b[d].created_at) + "&lt;/i&gt;&lt;/a&gt;"
                  }
                  c += "&lt;/marquee&gt;";
                  $("#twitter p").replaceWith(c);
                  Twitter.fancyMarquee()
              })
          },
          fancyMarquee: function () {
              $("#twitter marquee").marquee("pointer").mouseover(function () {
                  $(this).trigger("stop")
              }).mouseout(function () {
                  $(this).trigger("start")
              }).mousemove(function (a) {
                  if ($(this).data("drag") == true) {
                      this.scrollLeft = $(this).data("scrollX") + ($(this).data("x") - a.clientX)
                  }
              }).mousedown(function (a) {
                  $(this).data("drag", true).data("x", a.clientX).data("scrollX", this.scrollLeft)
              }).mouseup(function () {
                  $(this).data("drag", false)
              })
          },
          daysAgo: function (a) {
              if ($.browser.msie) {
                  return "1 day ago"
              }
              var b = (new Date(a)).getTime();
              var c = (new Date).getTime();
              var d = Math.round(Math.abs(c - b) / (1e3 * 60 * 60 * 24));
              var e = d + " days ago";
              if (d == 0) {
                  e = "today"
              } else if (d == 1) {
                  e = d + " day ago"
              }
              return e
          }
      };
      Twitter.init()
  })(jQuery);
  </code></pre>
  
  <p>Is there a way I can avoid the XMLHttpRequest problem?</p>
  
  <p>** <strong>Original post</strong></p>
  
  <p>I want to implement a horizontal marquee of my last 5 tweets and I followed this tutorial: <a href="http://artistutorial.blogspot.ro/2011/09/how-to-make-horizontal-scrolling.html" rel="nofollow">http://artistutorial.blogspot.ro/2011/09/how-to-make-horizontal-scrolling.html</a>. You can see my version of it <a href="http://bit.ly/MRckz9" rel="nofollow">here</a>
  The problem is that when I try to implement it on <a href="http://adfix.ro" rel="nofollow">my site</a> it's not loading any tweets and using the Chrome inspector I see an Uncaught TypeError</p>
  
  <pre><code>Cannot call method 'getJSON' of undefined 
  Twitter.insertLatestTweets 
  Twitter.init 
  (anonymous function)
  </code></pre>
  
  <p>I can't understand why it works on pastebin and not in my site. Any ideas?</p>