You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.8 KiB
52 lines
1.8 KiB
7 years ago
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<link rel="stylesheet" href="/static/main.css">
|
||
|
<script src="/static/jquery-3.3.1.min.js"></script>
|
||
|
<title> Yeah! </title>
|
||
|
<script type="text/javascript">
|
||
|
$("document").ready(function() {
|
||
|
// Do something...
|
||
|
$("#submit-chat").click(function(){
|
||
|
inputchat = $("#input-chat").val();
|
||
|
newHTML = '<div id="msg"><span class="chat-from">760 555 1212</span>: ' + inputchat + '</div>';
|
||
|
$("#chat-body").append( newHTML );
|
||
|
$.ajax({
|
||
|
method: "POST",
|
||
|
url: "/submitMessage",
|
||
|
data: { message: inputchat }
|
||
|
}).done(function( msg ) {
|
||
|
alert( "Data Saved: " + msg );
|
||
|
});
|
||
|
});
|
||
|
$('#test-ajax').click(function() {
|
||
|
$.ajax({
|
||
|
url: '/testAjax',
|
||
|
type: 'GET',
|
||
|
success: function(response) {
|
||
|
newHTML = '<div id="msg"><span class="chat-from">260 555 1212</span>: ' + response + '</div>';
|
||
|
$("#chat-body").append( newHTML );
|
||
|
},
|
||
|
error: function(error) {
|
||
|
console.log(error);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<h1 id="channel-name">(888) 555-1212</h1>
|
||
|
<div id="chat">
|
||
|
<div id="chat-body">
|
||
|
<div id="msg"><span class="chat-from">818 555 1212</span>: Hi how are you?</div>
|
||
|
<div id="msg"><span class="chat-from">818 555 1212</span>: Did you get this sample message?</div>
|
||
|
</div>
|
||
|
<div id="chat-input">
|
||
|
<input type="text" id="input-chat" />
|
||
|
<input type="button" id="submit-chat" value="Send"/>
|
||
|
<input type="button" id="test-ajax" value="test ajax"/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|