Should you find yourself in a situation where you want to call a function (or method) that accepts JSON data parameters that you want to actually print to the browser to be invoked on some sort of callback (onchange, onclick, etc).
Given the following function:
doSomething(JSONparam) {
// Something happens in here . . .
}
Here is the syntax for rendering an onclick link that is generated in JavaScript and then output to the DOM:
var $markup = ‘<a href=”some/url.html” onclick=”doSomething({\’key1\’:\’value’\, \’key2\’:\’value\’}); return false;”>Some link</a>’;