JSON
Here is the JSON structure where I am adding data with a button click event.
var myData = {
"info" : []
};
JavaScript Function
I have written this function to add data to the JSON object:
myData.info.push({
"Name" :name,
"Number" : num
});
Function to Display JSON Data
function displayJson(){
var obj = eval ("(" + myData + ")");
document.getElementById("newme").innerHTML=obj.info.Name;
}
This code doesn't seem to work as expected, any suggestions would be appreciated.
Thank you for taking time to assist me