0
localhost에서 YUI3을 사용하여 몇 가지 ajax 및 JSON 구문 분석 예제를 테스트하려고합니다. 다음과 같이 코드는 다음과 같습니다YUI3 JSON 구문 분석 및 IE9
<?php
header('Content-Type: application/json; charset=utf8');
echo(
json_encode(
array(
"time" => date("g:ia l, M jS")
)
)
);
나는 웹 호스트에 파일을 업로드 시도하고 여전히 같은 문제가 점점 오전 :
<!doctype html>
<html>
<head>
<title>YUI 3 Getting started</title>
</head>
<body>
<p id="time">(what time is it?)</p>
<button id="go">What time is it?</button>
<script src="http://yui.yahooapis.com/3.3.0/build/simpleyui/simpleyui-min.js"></script>
<script>
function printTime(id, response) {
try {
var data = Y.JSON.parse(response.responseText);
}
catch (ex) {
data = { time: "ERROR" };
}
Y.one("#time").setContent(data.time);
}
Y.one("#go").on("click", function() {
Y.io("watch.php", {
on: {
success: printTime
}
});
});
</script>
</body>
</html>
이 watch.php이다. 이상한 것은 파이어 폭스에서 완벽하게 작동하지만 IE9 및 다른 IE 모드에서는 작동하지 않는다는 것입니다. IE는이 오류 코드를 반환합니다 : c00ce56e
.
아이디어가 있으십니까?
확답 - 똑같은 두뇌 폭발 문제가 발생했습니다. utf-8에서 '-'를주의하십시오. 이것이 전체적인 차이입니다. –