Changing HTML5 text from JSON url getting error
<p>I have a problem getting content and replacing the text using Reddit's subreddit Shower thoughts for data. What I'm trying to do is replace the h1 text with ID title to one from the JSON file but instead i get:</p>
<p>Uncaught SyntaxError: Unexpected number at the var thought.</p>
<p>This is my javascript file for changing the text</p>
<pre><code>&lt;script&gt;
      $.ajax({
        url: 'https://www.reddit.com/r/showerthoughts/top.json',
        dataType: 'json',
        success: function( data )
        {
            var thought = data.children.0.data.title ;
            var author = data.children.'0'.data.author ;
    
            $('#title').text( thought );
        }
    });

  &lt;/script&gt;
</code></pre>
<p>This is the HTML file that has the title.</p>
<pre><code> &lt;body&gt;
    &lt;h1 class=&quot;title&quot; id=&quot;title&quot;&gt;Hello ! It's me&lt;/h1&gt;
    &lt;h5 class=&quot;author&quot;&gt;- author&lt;/h5&gt;
    &lt;video autoplay loop poster=&quot;forest.jpeg&quot; id=&quot;bgvid&quot; controls muted&gt;
        &lt;source src=&quot;walk.mp4&quot; type=&quot;video/mp4&quot;&gt;
    &lt;/video&gt;
    &lt;/body&gt;
</code></pre>