I'm trying to perform a super simple task with extensions which is: on click, open popup, find data on page, populate popup fields and ajax that data over to an external script. However, I can't seem to get the script to populate my popup nor log anything in the console nor alert()
me of anything, which is necessary so I know that I got the correct data. Here's what I'm running:
manifest.json
{
"manifest_version": 2,
"name": "Test ext",
"description": "Test ext",
"version": "0.2",
"background": {
"scripts": ["event.js", "jquery.min.js"],
"persistent": false
},
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
]
}
popup.html
<html>
<head>
<title>Auto Order</title>
</head>
<body>
<span>Order id:<p id="orderid"></p></span>
</body>
</html>
event.js
var orderid = $( "left post-rel" ).text();
alert(orderid);
console.log(orderid);
Again, I'm trying to make this as simple as possible. I assume once I understand how to populate popup.html
fields I'll understand how to ajax that data offsite.