0

I have a text file and I want that text into my <p id="top_ten"></p> I have not used jQuery before, but I was hoping I could give it try. Based on other sources, I feel like I am close, but I must be missing a detail or step somewhere.

This is what I currently have:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>S&#38P 500 Top Performers</title>
    <meta name="description" content="Gather top performers from S&#38P 500"/>
    <link rel="stylesheet" href="../static/css/styles.css"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
        $.get("../Todays_Top_Ten.txt", function(data) {
            document.getElementById("top_ten").src=data;
        })
    });
    </script>

</head>
<body>

    <h1>S&#38P 500 Top Performers</h1>

    <div class="sec" id ="sec_1">
        <p id="top_ten"></p>
    </div>
    <a href="{{ url_for('top_ten') }}">Top Ten</a>


</body>
</html>
Mwspencer
  • 1,142
  • 3
  • 18
  • 35

0 Answers0