Hello I am developing with chrome extension, i am working with ebay search api... Following is my html code:
<html>
<head>
<title>eBay Search Results</title>
<style type="text/css">body { font-family: arial,sans-serif;} </style>
<script type="text/javascript" src="j.js"></script>
</head>
<body>
<h1>eBay Search Results</h1>
<div id="results"></div>
</body>
</html>
javascript
function _cb_findItemsByKeywords(root) {
var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];
var html = [];
html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');
for (var i = 0; i < items.length; ++i) {
var item = items[i];
var title = item.title;
var pic = item.galleryURL;
var viewitem = item.viewItemURL;
if (null != title && null != viewitem) {
html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +
'<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td></tr>');
}
}
html.push('</tbody></table>');
document.getElementById("results").innerHTML = html.join("");
} // End _cb_findItemsByKeywords() function
var url = "http://svcs.ebay.com/services/search/FindingService/v1";
url += "?OPERATION-NAME=findItemsByKeywords";
url += "&SERVICE-VERSION=1.0.0";
url += "&SECURITY-APPNAME=myappid";
url += "&GLOBAL-ID=EBAY-US";
url += "&RESPONSE-DATA-FORMAT=JSON";
url += "&callback=_cb_findItemsByKeywords";
url += "&REST-PAYLOAD";
url += "&keywords=harry%20potter";
url += "&paginationInput.entriesPerPage=3";
// Submit the request
s=document.createElement('script'); // create script element
s.src= url;
debugger;
document.body.appendChild(s);
Following is manifest.json file
{
"manifest_version": 2,
"name": "eBay",
"description": "This extension demonstrates a 'browser action' with ebay products.",
"version": "1.0",
"browser_action": {
"default_icon": "ebayicon.png",
"default_popup": "MySample.html"
}
It gives my just <h1>
tag as output....
and following is an error that occurs:
**Uncaught TypeError: Cannot read property 'appendChild' of null **
I dont understand what exactly is it saying... Please help me understand above error.
Thank you