Edit in JSFiddle

var socket = new FIMKSocket("wss://cloud.mofowallet.org:7986/ws/");
socket.ready(function () {
  var args = {requestType: "getBlocks", lastIndex: 10};
  socket.callAPIFunction(args, function (data) {
    data.blocks.forEach(function (block) {
      write(["Block",block.height,"forged by",block.generatorRS].join(" "));
    });
  });
});
<script type="text/javascript">
function write (text) {
    var p = document.createElement('pre');
    p.textContent = text;
    document.getElementById("output").appendChild(p);
}
</script>
<div id="output"></div>