Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

359
Views
How can I use jQuery in JS file? (feat.Flask)

app.py

from flask import Flask, render_template, request, jsonify

app = Flask(__name__)

@app.route('/')
def home():
    return render_template('index.html')

if __name__ == '__main__':
    app.run('0.0.0.0', port=5000, debug=True)

index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="static/index.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    <script src="scripts/jquery-1.10.2.js"></script>
    <script src="/jquery/index.js"></script>

    <title>Title</title>
    <script>

    </script>
</head>
<body>
    <h1>Hello World!</h1>
</body>
</html>

index.js

$(function () {
    $(document).ready(function () {
        alert('Hello World');
    });
}

I think I'm doing something wrong. I want to show a message when the document is ready. Even if I run app.py, the alert doesn't appear.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

have you tried to embed the script directly inside the html code:

...
<script>your script code</script>
</body>
</html>

If that works, the relative path to src="/jquery/index.js" might be not correct.

Did you check logfiles from Apache (or whatever webserver you run) on errors related to index.js

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!