I'm newish to js/jquery and even newer to AJAX. I have a portfolio project where I'm trying to build a simple calendar (right now I'm just using fullcalendar) that is automatically populated with photos taken on each particular day. Originally it was doing this with the Instagram API but my review for public permissions was denied by Instagram and so to make my project work I had to hand-name every file with the correct date on it.
我对js / jquery很新,甚至比AJAX更新。我有一个项目组合项目,我正在尝试构建一个简单的日历(现在我只是使用fullcalendar),它会自动填充每个特定日期拍摄的照片。最初它是使用Instagram API执行此操作但我的公共权限审查被Instagram拒绝,因此为了使我的项目工作,我必须手动命名每个文件的正确日期。
Both with Instagram and with my method I got it to work locally, but once I began using github it no longer works.
无论是使用Instagram还是使用我的方法,我都可以在本地工作,但是一旦我开始使用github它就不再适用了。
If I navigate to http://ME.github.io/img/ I get a 404.
如果我导航到http://ME.github.io/img/我得到404。
If I navigate to http://ME.github.io/img/2015-12-31.jpg it loads the correct image.
如果我导航到http://ME.github.io/img/2015-12-31.jpg,它会加载正确的图像。
My code:
$.ajax({
url: "http://ME.github.io/img/",
success: function(data){
$(data).find('a:contains(".jpg")').each(function (){
// will loop through
console.log("Found a file: " + $(this).attr("href"));
});
}
});
Is there anything I can do about this? I'm assuming this is a github-specific issue since I had it working locally.
我能做些什么吗?我假设这是一个特定于github的问题,因为我在本地工作。
1 个解决方案
#1
0
Cross-origin requests are restricted usually, aren't on GitHub, too? Use browser JS console, or Fiddler, to determine it. If restricted, you should "proxy" your request by your back-end.
跨域请求通常是受限制的,也不在GitHub上?使用浏览器JS控制台或Fiddler来确定它。如果受限制,您应该通过后端“代理”您的请求。
#1
0
Cross-origin requests are restricted usually, aren't on GitHub, too? Use browser JS console, or Fiddler, to determine it. If restricted, you should "proxy" your request by your back-end.
跨域请求通常是受限制的,也不在GitHub上?使用浏览器JS控制台或Fiddler来确定它。如果受限制,您应该通过后端“代理”您的请求。