Onclick of some tab I am creating para tag and on that I want to add some text. How to add those value dynamically.
Here is what I am trying.
Onclick of tab I am calling this method.
SomeMethod = function(){
var para = document.createElement("P");
para.setAttribute("id", "myUL");
function getData(callback) {
debugger;
var httpRequest = new XMLHttpRequest();
httpRequest.open('GET', "../resource/para.json", true);
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE && httpRequest.status === 200) {
callback(httpRequest.responseText);
}
};
httpRequest.send();
}
getData(function(data) {
var jsonc = JSON.parse(data);
debugger;
document.getElementById('myUL').innerHTML = jsonc[0].VALUE;
});
}
My JSON data is
[{
"ID" : 0,
"VALUE" : "My 10000 Character text."
}]