I am currently hosting a website on Google App Engine, and the custom.html web-page includes a button that run a python script. My error is clicking that button activates the python script, but my page has the error Uncaught ReferenceError: jQuery is not defined
and clicking the button throws Failed to load resource: the server responded with a status of 404 ()
and a 404 GET
error:
send @ jquery-3.4.1.min.js:2
ajax @ jquery-3.4.1.min.js:2
goPython @ custom.html:61
onclick @ custom.html:55
Here is my app.js script where the error is coming from:
(function($){
$(function(){
$('.slider').slider();
$('.carousel').carousel();
$('.fixed-action-btn').floatingActionButton();
$('.tooltipped').tooltip();
$('.materialboxed').materialbox();
let tooltipInstances;
window.onload = function() {
M.FloatingActionButton.init(document.querySelectorAll('.fixed-action-btn'));
tooltipInstances = M.Tooltip.init(document.querySelectorAll('.tooltipped'));
// You should remove this event listener when it is no longer needed.
window.addEventListener('scroll', () => {
for (let i = 0; i < tooltipInstances.length; ++i) {
tooltipInstances[i]._positionTooltip();
}
});
}
}); // end of document ready
})(jQuery); // end of jQuery name space
And here is the custom.html page that includes the button:
<<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="../static/css/style.css">
</head>
<body>
<script src="../static/js/app.js"></script>
<!-- Content -->
<button style="text-align: center; margin-bottom: 150px" class="search-btn" type="button" value=" Run Script " onclick="goPython()">Do Something
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
<script>
function goPython() {
$.ajax({
url: "../Python/main.py",
context: document.body
}).done(function() {
alert('finished python script');;
});
}
</script>
</button>
</div>
</div>
</body>
</html>
Lastly, while troubleshooting, I removed <script src="../static/js/app.js"></script>
from custom.html (in case this was causing the jquery issue, which seems to have disappeared but I'm not sure if this was the cause), but I still receive the other same errors under Chrome's developer tools.
Any advice and insight is greatly appreciated.
Please login or Register to submit your answer