1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- $("#user-input-form").submit(
- function (event) {
- event.preventDefault();
-
- var question = $('#user-input').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
- })
- .done(function (data) {
-
-
- setTimeout(() => {
-
- addListItem(data);
- }, Math.floor(Math.random() * (4000 - 600 + 1)) + 600);
- })
- });
- function addListItem(input) {
-
- $("#output-area").append('<li>' + input + '</li>')
-
-
- $('#output-area').animate({
- scrollTop: $('#output-area').prop("scrollHeight")
- }, 300);
- }
|