使用javascript和jquery从外部文件div填充div

pre*_*pii 4 html javascript jquery jquery-load

这里很沮丧.不能让这个工作,不知道为什么.我试图用另一个html文件中的div填充我的div.这是我的代码:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

<div id="text">
content goes here
</div>

<script type="text/javascript">
    function whenButtonClicked() {
        var book = document.getElementById("book").value; //this is working
        var chapter = document.getElementById("chapter").value; //this is working
        var filename = 'files/' + book + chapter + '.html'; //this is working
        $('#text').load(filename #source); //this is NOT
    }

</script>
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助.

亚当

编辑:这是我正在处理的实际文件的链接.它也可能有问题.

Dan*_*kov 7

使用此代码:$('#text').load(filename + " #source");.