jQuery와 AJAX를 배우기 시작했습니다. 내 디스크의 로컬 페이지를 jQuery.load()
을 통해 div에로드 할 수 있지만 외부 사이트가 작동하지 않는 것 같습니다. 나는 wireshark를 사용하여 데이터가 서버에서 전송되는지 확인합니다 (있는 그대로). 샘플 코드는 다음과 같습니다.AJAX를 통해 외부 페이지에서 데이터를로드 할 수 있습니까?
<html>
<head>
<script src='jquery-1.4.2.min.js'></script>
<script>
$(document).ready(function() {
// $('#test').load('localpage.htm'); works!
$('#test').load('http://www.google.com/'); // does not work!
});
</script>
</head>
<body>
<div id='test'></div>
</body>
</html>
처음부터 가능합니까? 그렇다면 어떻게?
비슷한 질문 http://stackoverflow.com/questions/ 2217695/json-with-jquery/2217707 # 2217707 – yanoo