mesajın gönderildiğine dair js kodu ekleyince form gönderim yapmıyor.

<section class="contact" id="contact">

        <h2 class="heading">Contact <span>Me!</span></h2>

        <form action="/users" method="post" id="myForm">

            <div class="input-box">
                <input type="text" placeholder="Full Name" name="name" required>
                <input type="email" placeholder="Email Address" name="email" required>
                <input type="number" placeholder="Mobile Number" name="phone">
            </div>

            <textarea name="message" id="" cols="30" rows="10" placeholder="Your Message Here!" required></textarea>
            <input type="submit" value="Send Message" class="btn" name="send">

        </form>
        <div id="message"></div>
    </section>
from flask import Flask, render_template, request, jsonify
from flask_mail import Mail, Message

app = Flask(__name__)

app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USE_SSL'] = False
app.config['MAIL_USERNAME'] = 'asker244897@gmail.com'
app.config['MAIL_PASSWORD'] = 'wovivtrwmfzedsef'

mail = Mail(app)

@app.route("/")
def home():
    return render_template("index.html", hata="")

@app.route("/users", methods=['POST'])
def index():
    if request.method == 'POST':
        name = request.form.get('name')
        phone = request.form.get('phone')
        email = request.form.get('email')
        message = request.form.get('message')

        # print(name, phone, email, message)  

        try:
            msg = Message('Mesaj', sender=app.config['MAIL_USERNAME'], recipients=['asker244897@gmail.com'])
            msg.body = f"Name: {name}\nPhone: {phone}\nEmail: {email}\nMessage: {message}"
            mail.send(msg)
            # return jsonify({"success": True})  
            
        except Exception as e:
            app.logger.error(f"An error occurred: {str(e)}")
            # return jsonify({"error": "An error occurred while processing your request.", "success": False})

    return render_template("index.html", hata="")

if __name__ == "__main__":
    app.run(debug=True)

ekleyince flaskı engelleyen js kodu

document.addEventListener('DOMContentLoaded', function () {
    document.getElementById('myForm').addEventListener('submit', function (e) {
        e.preventDefault();

        fetch('/users', {
            method: 'POST',
            body: new FormData(this),
        })
        .then(response => response.json())
        .then(data => {
            const messageDiv = document.getElementById('message');
            if (data.success) {
                messageDiv.textContent = "mesaj başarıyla gönderildi!";
                setTimeout(function() {
                    messageDiv.textContent = '';
                }, 3000);
            } else {
                messageDiv.textContent = "mesaj gönderilirken hata oluştu.";
            }
        })
        .catch(error => console.error('Hata:', error));
    });
});
kullanıcı send message tıklayınca mesajın gönderildiğine dair 3sn bildirim yapıp kaybolan bir kod