Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript Script parsing values onto JSP page
    primarykey
    data
    text
    <p>So I have a Javascript script (don't judge it, i've barely used the technology before and this is in need of a tidy!)</p> <pre><code>$(document).ready(function() { retrieveComments(); }); function retriveComments(){ videoID = readCookie("currentVideoID"); $.get("https://gdata.youtube.com/feeds/api/videos/" +videoID+ "/comments", function(d){ $(d).find("entry").each(function(){ var $entry = $(this); var author = $entry.attr("author"); var comment = $entry.find("content").text(); var html = '&lt;div class="videoComments"&gt;'; html += '&lt;p class="author"&gt;" + author + "&lt;/p&gt;'; html += '&lt;p class="comment"&gt; " + comment + "&lt;/p&gt;'; html += '&lt;/div&gt;'; }; $('#comments').append(html); }); </code></pre> <p>And I wish to retrieve the values author and content (comment), and display it on the page. Examples I have found over the course of the day have shown 2 seperate files one with the script in and one a .jsp with the page content in, then class tags (?) corresponding to the last line (in my case #comments).</p> <p>Seeing as I don't need any other content than just the data I've retrieved and the content I've built in the script, I have this:</p> <pre><code>&lt;div id="comments"&gt; &lt;/div&gt; </code></pre> <p>but it doesn't display, and I can't see what I have different hin my case.</p> <p>My whole page looks like:</p> <pre><code>&lt;script type="text/javascript"&gt; var videoID = readCookie("currentVideoID"); $(document).ready(function() { retrieveComments(); }); function retriveComments(){ videoID = readCookie("currentVideoID"); $.get("https://gdata.youtube.com/feeds/api/videos/" +videoID+ "/comments", function(d){ $(d).find("entry").each(function(){ var $entry = $(this); var author = $entry.attr("author"); var comment = $entry.find("content").text(); var html = '&lt;div class="videoComments"&gt;'; html += '&lt;p class="author"&gt;" + author + "&lt;/p&gt;'; html += '&lt;p class="comment"&gt; " + comment + "&lt;/p&gt;'; html += '&lt;/div&gt;'; }; $('#comments').append(html); }); }); &lt;/script&gt; &lt;h1&gt;TEST&lt;/h1&gt; &lt;div id="comments"&gt; &lt;/div&gt; </code></pre> <p>Any ideas how I can get that HTML to display?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload