更新
我刚刚测试了链接到我的例子和...该死的事情的作品。我不相信?任何意见仍然欢迎。
我刚刚更新了我的浏览器,Chrome拒绝了我的(以前工作的)ajax调用包含html的简单文本文件。这是我目前的裸机代码:
var stringData = $.ajax({ url: 'digz/index/'+$(this).attr("id")+'.txt', async: false }).responseText;
var $newItems = $(stringData);
alert($newItems.filter('.element').length); // FF & IE OK but Chrome = '0'
// there are few things here and I have tested with them rem'd out
$('#container').isotope('insert', $newItems); // std. isotope form
中的Chrome控制台给我:
Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin.
XMLHttpRequest cannot load [...file path/name... ] Origin null is not allowed by Access-Control-Allow-Origin.
和指针jQuery中 - 在版本1.9.0
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send((s.hasContent && s.data) || null);
周围线8472我在这里有一个精简版的项目:
Null return on Ajax
我认为ajax行是问题,需要修改。我尝试了很多替代排列,但有很多选择和我的经验是有限的。
看看是否有帮助http://stackoverflow.com/a/10866062/1331430 –
@FabrícioMatté - 感谢您的链接。您在我的保存和更新之间张贴。往上看。是的,我意识到我需要使用Chrome在服务器环境中运行本地版本。 FF&IE对当地的关系非常满意。我将尝试“--allow-file-access-from-files”并查看它是如何工作的。谢谢。使用localhost开发 – Arfa