<p>I'm trying to get a Firefox plugin to read data from a HTTP get, parse the results and present them as links in a bookmark-like drop-down menu.</p>

<p>My quesion then is: Does anyone have any sample code that will do this?</p>

[{'answer_id': 40167, 'author': 'Robert J. Walker', 'author_id': 4287, 'author_profile': 'https://Stackoverflow.com/users/4287', 'pm_score': 2, 'selected': False, 'text': '<p>Having never developed one myself, I\'m not certain how this is typically done in Firefox plugins, but since plugin scripting is JavaScript, I can probably help out with the loading part. Assuming a variable named url containing the URL you want to request:</p>\n\n<pre><code>var xmlhttp = new XMLHttpRequest();\nxmlhttp.open("GET", url, true);\n\nxmlhttp.onreadystatechange = function() {\n    if(this.readyState == 4) { // Done loading?\n        if(this.status == 200) { // Everything okay?\n            // read content from this.responseXML or this.responseText\n        } else { // Error occurred; handle it\n            alert("Error " + this.status + ":\\n" + this.statusText);\n        }\n    }\n};\n\nxmlhttp.send(null);\n</code></pre>\n\n<p>A couple of notes on this code:</p>\n\n<ul>\n<li>You may want more sophisticated status code handling. For example, 200 is not the only non-error status code. Details on status codes can be found <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" rel="nofollow noreferrer">here</a>.</li>\n<li>You probably want to have a timeout to handle the case where, for some reason, you don\'t get to readyState 4 in a reasonable amount of time.</li>\n<li>You may want to do things when earlier readyStates are received. <a href="http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest-object" rel="nofollow noreferrer">This page</a> documents the readyState codes, along with other properties and methods on the XMLHttpRequest object which you may find useful.</li>\n</ul>\n'}, {'answer_id': 58273, 'author': 'pc1oad1etter', 'author_id': 525, 'author_profile': 'https://Stackoverflow.com/users/525', 'pm_score': 0, 'selected': False, 'text': '<p>Robert Walker did a great job of describing <a href="https://stackoverflow.com/questions/40125/reading-from-a-http-get-presenting-in-firefox-bookmarks#40167">how to send the request</a>.  You can read more about <a href="http://developer.mozilla.org/En/XMLHttpRequest" rel="nofollow noreferrer">Mozilla\'s xmlhttprequest here</a>.</p>\n\n<p><strike>I would just add that the response would be found (using Robert\'s code) using</p>\n\n<pre><code> xmlhttp.responseText\n</code></pre>\n\n<p></strike>\n(<em>Edit - i didn\'t read closely enough, thanks Robert</em>)</p>\n\n<p>You didn\'t indicate exactly what the data was, although you mentioned wanting to parse links from the data.  You could the xmlhttp.responseText as an xml document, parse out the links, and place it into a menulist or whatever you like.</p>\n'}]
['https://Stackoverflow.com/questions/40125', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4165/']