jquery를 처음 사용하고 jquery의 load() 함수를 사용하여 컨테이너 div에로드 할 html 문서를 가져 오는 데 문제가 있습니다.Jquery에서 간단한 load() 테스트가 작동하지 않습니다.
동일한 기본 레벨 html 폴더 내의 외부 웹 서버에있는 두 HTML 파일 모두에서이 테스트를 실행하고 있습니다.
로드()를 제공하는 click 함수에 경고를 작성하여 브라우저가 js 함수를 인식하는지 테스트하고 FF와 Chrome에서 알림이 제대로 표시되지만 HTML 문서는로드되지 않습니다. .
제공할만한 도움에 감사드립니다. 바라기를 이것은 끔찍하게 명백한 뭔가를 놓친 것입니다.
감사합니다.
컨테이너 사업부와 기본 HTML 파일 (bindtestone.html) :
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("li#loader").click(function() {
$("#container").load("bindtesttwo.html").fadeIn("fast");
alert("this link is working");
});
});
</script>
<style type="text/css">
#loaderdiv { width:300px; border:1px solid #000;
position:relative; }
#container { width:500px; height:400px; border:1px solid #000;
position:relative; overflow:visible; }
#dynacontent { width:100px; border:solid 1px #000;
position:relative; }
</style>
</head>
<body>
<div id="loaderdiv">
<ul><li id="loader"><a href="">load file</a></li></ul>
</div>
<div id="container">
</div>
</body>
</html>
내가 jQuery를 사용하여로드하기 위해 노력하고있어 두 번째 html 파일 (bindtesttwo.html) :
<!doctype html>
<html>
<head>
</head>
<body>
<div id="dynacontent">
<a href="">This is a link</a>
</div>
</body>
</html>
당신이 볼 수있는 콘솔 디버깅을 시도 했
<a href>
태그 제거? – j08691나는 게시하기 전에 한 다음, 아래에 제안 된 변경 사항과 함께 다시했습니다. FF와 Chrome의 콘솔은 오류를 던지거나 누락 된 요소를 알려주지 않습니다. – Lisa
임 링크가 당신의 페이지를 다시로드시키는 원인이되는 링크입니다 :) ... 리의 링크는 – Ryan