I got a piece of code in here:
$.get("/upcase", {text: text})
.done((data) => {
$('#results').prepend('<li>' + data['result'] + '</li>');
$('#input').val(''); // reset the textbox
});
Usually the data data['result']
will be pass to a html <ul>
tag with id="results"
to form a list, but what if I want to store it into a variable, how do I achieve that?
At least it does not work like this:
let something = $('#results').val(data['result']);