12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- $("#user-input-form").submit(
- function (event) {
- event.preventDefault();
-
- var question = $('#user-input').val().trim()
- var bot = $('#bot-name').val().trim()
- var session = $('#session-id').val().trim()
-
- $('#user-input').val("");
-
- if (!question) {
- return;
- }
-
- $("#output-area").append('<li>' + question + '</li>');
-
-
- $('#output-area').animate({
- scrollTop: $('#output-area').prop("scrollHeight")
- }, 300);
- $.get('/user-input', {
- value: question,
- bot: bot,
- session: session
- })
- .done(function (data) {
-
-
- setTimeout(() => {
-
- addListItem(data);
- }, Math.floor(Math.random() * (2000 - 600 + 1)) + 600);
- })
- });
- function addListItem(input) {
-
- $("#output-area").append('<li>' + input + '</li>')
-
-
- $('#output-area').animate({
- scrollTop: $('#output-area').prop("scrollHeight")
- }, 300);
- }
|