** 는 UPDATE :api.twitter.com에 XMLHttpRequest를 작성하는 문제를 해결하려면?
XMLHttpRequest cannot load http://api.twitter.com/1/statuses/user_timeline.json?screen_name=bogdanch&. Origin http://adfix.ro is not allowed by Access-Control-Allow-Origin.
내가 사용하는 코드는 다음과 같습니다 :
(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 + "&count=" + b + "&callback=?";
$.getJSON(c, function (b) {
var c = '<marquee behavior="scroll" scrollamount="1" direction="left">';
for (var d in b) {
c += '<a href="http://twitter.com/' + a + "#status_" + b[d].id_str + '">' + b[d].text + " <i>" + Twitter.daysAgo(b[d].created_at) + "</i></a>"
}
c += "</marquee>";
$("#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);
내가 피할 수있는 방법이 있나요
은 분명히 문제는 XMLHttpRequest의 문제로 변신 XMLHttpRequest 문제?
** 원래의 게시물
내가 내 마지막 5 개 트윗의 수평 윤곽을 구현하려는 나는이 튜토리얼 다음 : http://artistutorial.blogspot.ro/2011/09/how-to-make-horizontal-scrolling.html합니다. 당신은 문제는 내가 어떤 트윗을로드하고 내가 캐치되지 않는 형식 오류를 볼 수있는 크롬 관리자를 사용하지 않는 것 my site에 그것을 구현하려고 할 때
Cannot call method 'getJSON' of undefined
Twitter.insertLatestTweets
Twitter.init
(anonymous function)
내가 이유를 이해할 수 없다는 것입니다 그것을 here 의 내 버전을 볼 수 있습니다 내 사이트가 아닌 pastebin에서 작동합니다. 어떤 아이디어?
일부 코드를 게시 할 수 있습니까? – Utkanos