Hice coding #7
How to publish a post/comment
by hive_coding
HTML
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@hiveio/hive-js/dist/hive.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
<body>
<textarea id="mybody"></textarea>
<button id="post">Post</button>
<script>
$("#post").click(function() {
//publish a post - Einen beitrag veröffentlichen
var wif="YourPrivatePostingKeyNevverUseronJSFiddleNiemalsAufJSFiddleEingeben";
var title="Hivejs: How to publish a post/comment - Wie veröffentlicht man einen Beitrag/Kommentar? #7";
var body=$("#mybody").val();
var tags="hive coding deutsch hive-engine hivejs hive-coding pob hive-js";
var taglist=tags.split(' ');
var parentPermlink=taglist[0];
var author="hive-coding";
var permlink="use-whatyou-want-but-unique-per-post";
//permlink=Math.random().toString(36).substring(2);
permlink="hivejs-how-to-publish-a-post-or-comment";
var jsonMetadata= new Object();
jsonMetadata.tags= taglist;
jsonMetadata.app="hive-coding/ 1.0";
jsonMetadata.format="markdown+html";
hive.broadcast.comment(wif, "", parentPermlink, author, permlink, title, body, jsonMetadata, function(err, result) {
console.log(err, result);
});
});
</script>
</body>
</html>