템플릿 페이지에서 HTML을로드 한 다음 XML에서 콘텐츠를로드하는 웹 사이트를 개발 중입니다. 예를 들어 이것들은 document.ready 함수에서 호출됩니다.Google 크롬 - 실패한 GET ajax 요청
$.ajax({
type : "GET",
url : "template.html",
dataType : "html",
success : function(html) {
var ndoc = document.createElement('html');
ndoc.innerHTML = html;
page = $('body', ndoc);
$('body').html(page.html());
$.ajax({
type : "GET",
url : "XML/content.xml",
dataType : "xml",
success : function(xml) {
page = $(xml).find('chisiamo').find('dialogue')[0];
setupPage(page);
}
});
}
});
이것은 Firefox와 Safari에서 잘 작동합니다. 하지만 크롬에서는 template.html을로드하려고 할 때 'Access-Control-Allow-Origin이 Origin의 null을 허용하지 않습니다.'라는 메시지가 표시됩니다. 이 문제를 어떻게 해결할 수 있습니까? 고마워요.
그 스크린 샷을 보여 주시겠습니까? – zerkms
스크린 샷? 이것은 Chrome 콘솔에서 얻을 수있는 정확한 문자열입니다. 'XMLHttpRequest는 file : ///Users/***/Dropbox/CorpoMusicale/template.html을로드 할 수 없습니다. Origin Null은 Access-Control-Allow-Origin에 의해 허용되지 않습니다. ' – Lorenzo
본 적이 있습니까? http://stackoverflow.com/questions/5224017/origin-null-is-not-allowed-by-access-control-allow-origin-in-chrome-why – Igor