加载并运行外部.js源

时间:2014-06-17 12:09:22

标签: javascript jquery html

我有一个外部.js源,当我在内部使用脚本时工作正常,但我想使用按钮使其可重新加载,因此当我单击按钮时,它将脚本加载到div中,而不必刷新页面,虽然我没有...没有jQuery的经验,当我使用脚本...

    <button id="SpotifyPlaying">(Re)Load</button>
    <script>
    $(document).ready(function () {
         $("#SpotifyPlaying").on("click", function () {
            $("#playing").load("/spotifyhtml.js")
         });
    });

</script>

它没有出现在div中。该脚本使用

var element = document.getElementById("playing");
element.innerHTML = r;

并且代码正常运行,以及它在其中运行的div是:

<font face="verdana" size="3" color="white"><div id="playing" style="height:25px;"></div><br></font>

如果您需要更多信息,请发表评论。

spotifyhtml.js = this link

的内容

0 个答案:

没有答案
相关问题