jsoneditor4code
Version:
JSON Editor for UML Diagrams developed with Javascript Code Templates based on JSON Editor of Jeremy Dorn
45 lines (44 loc) • 1.21 kB
HTML
<html>
<head>
<meta charset="utf-8">
<title>Receiver of Params</title>
<script src="js/linkparam.js"></script>
</head>
<body>
<h3>
Link Parameter Key:
<tt id="keyout">myparam</tt>
</h3>
<form action=""
<textarea id="textout" rows="20" cols="120">undefined content</textarea>
<script>
var vKey = "jsondata";
var vLinkParam = new LinkParam();
vLinkParam.init(document);
if (vLinkParam.exists(vKey)) {
var vPar = vLinkParam.getValue(vKey);
//alert(vPar);
document.getElementById("keyout").innerHTML = vKey;
console.log("Link Parameter '"+vKey+"' exists!")
var vJSON = null;
try {
vJSON = JSON.parse(vPar);
} catch(e) {
alert("ERROR: "+ e)
};
if (vJSON) {
vPar = JSON.stringify(vJSON,null,4);
}
document.getElementById("textout").value = vPar;
} else {
alert("Receiver needs a LinkParameter 'myparam'")
};
vKey = "callback";
if (vLinkParam.exists(vKey)) {
var vPar = vLinkParam.getValue(vKey);
document.getElementById("callback").value = vPar;
};
</script>
</body>
</html>