This issue is resolved.
JSON code:
Code:
{
"Caption": "Module caption",
"Buttons":
[
{"Text":"google", "Url": "window.open(\"http://www.google.com/\")"},
{"Text":"yahoo", "Url": "window.open(\"http://www.yahoo.com/\")"},
{"Text":"microsoft", "Url": "window.open(\"http://www.microsoft.com/\")"},
{"Text":"facebook", "Url": "window.open(\"http://www.facebook.com/\")"}
]
}
html code:
Code:
<html>
<head>
<title>SMButtons</title>
<script src="JQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
//When document loaded.
$(document).ready(function(){
// Get data from file as JSON
$.getJSON('Module.json', function(data) {
// Set json data from file to variable 'persons'
var buttons = data.Buttons;
// For each item of variable person append to ul list
$.each(buttons, function(key, val)
{
$("<li><input type='button' onClick='"+ val.Url +"' value='"+ val.Text +"'/></li>").appendTo('#aaa');
});
});
});
</script>
</head>
<body>
<ul id='ulObj'></ul>
<ul id='aaa'>
<li>1</li>
<li>2</li>
</ul>
</body>
</html>