JSON
Posted: 21 Oct 2015
Hi
I have made a HTML with the contens below (the button is not in use yet)
It works fine as it is below but I want to make it dynamical ie change
THIS: obj = {"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567","MC":"Yes"};
to THIS var obj=fd.field('JSON').value();
ie read into obj from a sharepoint list multiline field, but it does not work - any suggestions?
MY HTML:
<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<button onclick="hh()">JSON</button>
<p id="demo3"></p>
<script>
obj = {"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567","MC":"Yes"};
//var obj=fd.field('JSON').value();
document.getElementById("demo3").innerHTML =
obj.name + "<br>" +
obj.street + "<br>" +
obj.MC + "<br>" +
obj.phone;
</script>
</body>
</html>
I have made a HTML with the contens below (the button is not in use yet)
It works fine as it is below but I want to make it dynamical ie change
THIS: obj = {"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567","MC":"Yes"};
to THIS var obj=fd.field('JSON').value();
ie read into obj from a sharepoint list multiline field, but it does not work - any suggestions?
MY HTML:
<!DOCTYPE html>
<html>
<body>
<h2>JSON Object Creation in JavaScript</h2>
<button onclick="hh()">JSON</button>
<p id="demo3"></p>
<script>
obj = {"name":"John Johnson","street":"Oslo West 16","phone":"555 1234567","MC":"Yes"};
//var obj=fd.field('JSON').value();
document.getElementById("demo3").innerHTML =
obj.name + "<br>" +
obj.street + "<br>" +
obj.MC + "<br>" +
obj.phone;
</script>
</body>
</html>