내 구조는 다음과 같습니다하기 : Google 크롬 확장 프로그램. JSON 데이터는 로컬
내의 manifest.json은 다음과 같습니다
{
"manifest_version": 2,
"name": "Doktor-MD",
"description": "Tarayıcı üzerinden Doktor-MD'de link paylaşımı yapabilirsiniz.",
"version": "1.0",
"permissions": [
"http://www.google.com/"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "index.html"
}
}
내 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="Getir" onclick="GetDataFunction"/></td>
</tr>
</table>
</body>
</html>
내 설정을 .json 데이터 (예제 데이터)는 다음과 같습니다.
{
"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"
}
}
}
}
}
내 config.json에서 json 데이터를 가져오고 싶습니다. 하지만 어떻게 작동하는지 확인하기 위해이 코드를 테스트 할 수는 있습니다. 내가 맞다고 생각하니? 로컬에서 json 값을 얻으려면이 올바른 방법입니까?
도움 주셔서 감사합니다. – fuat