function uploadJsonFunction(){
var jsonURL = "C:\Users\My Documents\new\WebContent\JsonFiles\TreeJson\countries.json";
}
Here is my Json:
{
identifier: 'id',
label: 'name',
items: [
{
id: 'AF',
name: 'Africa',
type:'continent'
}
]
}
$.ajax({
url: "\countries.json",
success: function (data) {
var obj = JSON.parse(data);
}
});
For safety reasons, The C:\\Users\\My Documents\\new\\WebContent\\JsonFiles\\TreeJson\\countries.json
url won't work in a browser.
Why not to try Google: http://www.json.org/js.html
I used this for Android app that worked with PhoneGap(HTML+Javascript+JQuery)
Worked fine.
My Method:
var link_name = pathtojson.json
$.getJSON(link_name,
function(data){
var ttext = (data["SearchResponse"]["Translation"]["Results"][0]["TranslatedTerm"]);
document.getElementById('ttexti').innerHTML = ttext;
}
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.