Trying to incorporate ajax into my spring boot project, I encountered an issue with the following error code: Uncaught TypeError: $.ajax is not a function
After going through all the previous suggestions, it was identified that the problem stemmed from using the slim version. Despite attempting various solutions, none seemed to resolve the issue.
Below is the snippet of my code:
pom.xml
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>jquery</artifactId>
<version>3.5.1</version>
</dependency>
page.html
<script src="https://code.jquery.com/jquery-3.5.1.js" type="text/javascript"></script>
...
<script type="text/javascript">
... ajax code
Further investigation revealed that despite specifying the 3.5.1 version, my project continued to utilize the slim version in the browser.
Uncaught TypeError: $.ajax is not a function
at HTMLButtonElement.<anonymous> (7:156)
at HTMLButtonElement.dispatch (jquery-3.4.1.slim.min.js:2)
at HTMLButtonElement.v.handle (jquery-3.4.1.slim.min.js:2)
https://i.sstatic.net/hc9Qp.png
Spent the entire day troubleshooting this issue, but couldn't pinpoint why the program defaulted to the 3.4.1.slim version instead of 3.5.1.