简体   繁体   English

Spring启动javascript没有执行?

[英]Spring boot javascript not executing?

I'm working on a spring mvc application, and my javascript is directly in my html files. 我正在开发一个spring mvc应用程序,我的javascript直接在我的html文件中。 For whatever reason, this code is never executed. 无论出于何种原因,此代码永远不会执行。 I even have a coded in breakpoint and it's never hit. 我甚至有一个断点编码,它永远不会被击中。 No errors or anything are thrown from the chrome debugger. chrome调试器没有抛出任何错误或任何内容。 It seems like nothing runs at all, even when I write jibberish. 似乎没有什么可以运行,即使我写的是胡言乱语。 I've tried explicitly defining jquery in case there were any conflicts, but there is nothing. 我已经尝试过显式定义jquery,以防有任何冲突,但没有任何东西。 This is the code on the bottom of my page. 这是我页面底部的代码。

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
    $(document).ready(function(e){
        debugger;
        alert( "ready!" );

    });
</script>

You should not use any script inside the script tag which is used to link a js file. 您不应在script标记内使用任何用于链接js文件的script Create another script tag and paste your code in it: 创建另一个script标记并将代码粘贴到其中:

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ alert("ready!"); }); </script> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM