Following on from this question, I have managed to save my chatbot's conversation history as a flat json file. I would now like to see the contents of the json in the index.html
file. I tried using this code in my html, but I get a blank page
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
<script>
$(function() {
$.getJSON('chathistory.json', function(json) {
console.log(json);
});
});
</script>
</head>
</html>
My chatbot conversation logging code:
bot.use({
botbuilder: function (session, next) {
//console.log(session.message.text);
test="\r\nUSER: "+session.message.text;
fs.appendFile(filename, test, function(err){ });
next();
},
send: function (event, next) {
//console.log(event.text);
test="\r\nBOT: "+event.text;
fs.appendFile(filename, test, function(err){ });
next();
}
});
My chathistory.json file:
USER: hi
BOT: Hi, I am your chatbot.
BOT: What is your name?
USER: Anish
BOT: Hello, Anish. How may I help you today?
How can I see this data in my index.html page?
via Anish
No comments:
Post a Comment