简体   繁体   中英

Spring boot and Thymeleaf application: jquery is loading but not executing

I have created a simple spring boot application for my View is loading jquery but not executing it.Details are below: My Project structure

[ [1]

My Controller

在此处输入图片说明

My JqueryCode

在此处输入图片说明

My HTML page that import jQuery 在此处输入图片说明

Chrome Inspector shows jquery is loaded fine

在此处输入图片说明

But still my jQuery code is not running, and if I try running it directly from console., is says jQuery is not Defined

Guys please tell me what am i doing wrong / or missing.

If you change the:

<script type="javascript"

to

<script type="application/javascript"

it should work, type='javascript' is not a defined media type according to http://www.iana.org/assignments/media-types/media-types.xhtml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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