I am not sure if this has been addressed or not (I am sure it probably has been), but I am having issues figuring it out and cannot seem to find exactly what I am looking for. Here is what I have for my chatbox:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<style>
body {
font:16px Helvetica;
color: #a8199f;
text-align:center;
padding:35px; }
form, p, span {
    margin:0;
    padding:0; }
input { 
    font:16px Helvetica; }
a {
    color:#0000FF;
    text-decoration:none; }
a:hover { 
    text-decoration:underline; }
#wrapper {
    margin:0 auto;
    padding-bottom:25px;
    background: #bdbbb7;
    width:50%;
    border:1px solid #ACD8F0; }
#chatbox {
    text-align:left;
    margin:0 auto;
    margin-bottom:25px;
    padding:10px;
    background:#fff;
    width:50%;
    border:1px solid #ACD8F0;
    overflow:auto; }
#chatbox p {
    padding:1em;
    margin:1em;
    background:#afd6ed;
    border:1px solid #BDBDBD;
    -moz-border-radius:4px;
}
#usermsg {
    width:50%;
    border:1px solid #ACD8F0; }
#submit { 
    width: 60px; }
.welcome { 
    float:left; }
.logout { 
    float:right; }
.msgln { 
    margin:0 0 2px 0; }
    </style>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" ></script>
</head>
<body>
<div id="wrapper">
    <div id="menu">
        <p class="welcome">Welcome</p>
        <p class="logout"><a id="exit" href="#" onclick="window.close();">Exit Chat</a></p>
        <div style="clear:both"></div>
    </div>
    <div id="chatbox">
        <p>Here's our chat data</p>
        <div id="update"></div>
    </div>
    <form name="message">
        <input name="usermsg" type="text" id="usermsg" size="63" />
        <button type="button" id="submitmsg" value="send">Send</button>    
    </form>
</div> 
<script>
    $(document).ready(function(){
        $('#submitmsg').click(function(){
            var message = $('#usermsg').val();
            $('#chatbox').append('<p>' + message + '</p>');
            $('#usermsg').val('');
        });
    });
 function close_window(url){
        var newWindow = window.open('', '_self', ''); //open the current window
        window.close(url);
    };
</script>
<script src="script.js"></script>
</body>
</html> 
I want to make this .json file:
[
  {
    "response":"Hello",
  },
  {
    "response":"How may I help you?",
  },
  {
    "response":"Let me look into that for you.",
  },
  {
    "response":"Can you give me more information about that?",
  },
  {
    "response":"Is there anything else I can help you with?",
  },
  {
    "response":"Thank you, Have a good day.",
  }
]
be the response for user messages. I have tried this script, but I know I am missing stuff and just cannot seem to grasp it by myself or find the appropriate information. Any help or references would be greatly appreciated. Thank you.
$('#usermsg').keyup(function(){
        var userResponse = $('#usermsg').val();
        $.getJSON('data.json', function(data){
            var output = '<div class="repsonse">';
            $.each(data, function(key, val){
                if(val.response != -1){
                    output += '<p>' + val.response + '</p>';
        });
        output += '</div>';
        $('#update').html(output);
    });
});
 
    