Here is the structure I have:
And below is my manifest.json:
{
"manifest_version": 2,
"name": "Doktor-MD",
"description": "Share links on Doktor-MD through the browser.",
"version": "1.0",
"permissions": [
"http://www.google.com/"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "index.html"
}
}
Now, take a look at my index.html:
<!DOCTYPE html>
<html>
<head>
<META http-equiv=content-type content=text/html;charset=utf8>
<META http-equiv=content-type content=text/html;charset=windows-1254>
<META http-equiv=content-type content=text/html;charset=x-mac-turkish>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
<script src="doktormdcore.js"></script>
<title>Doktor TV Md</title>
<script type="text/javascript">
function GetDataFunction()
{
var xhr = new XMLHttpRequest();
xmlHttpRequest.onreadystatechange = handleStateChange; // Implemented elsewhere.
xmlHttpRequest.open("GET", chrome.extension.getURL('/config_resources/config.json'), true);
xmlHttpRequest.send();
}
</script>
</head>
<body>
<table>
<tr>
<td>GetData</td>
<td><input type="button" id="GetData" value="Get Data" onclick="GetDataFunction"/></td>
</tr>
</table>
</body>
</html>
Here's an example of my config.json data:
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
I am trying to retrieve JSON data from my config.json file. How can I test this code to verify that it works correctly? Do you think I am approaching this the right way to get local JSON values?