I'm using python 3 + airium + bottle + spectre. I know almost nothing about javascript.
I want to have a table with cells (lots of them) that are input fields, each with a unique key. When the user types in a cell and hits enter, I want to generate a call to a url like /addnote/UNIQUEKEY/userstextinput/.
I'm starting from an older broken prototype (using flask, jinja2, bootstrap and jQuery) but don't really understand the code. I got it working a long time ago starting from a stackoverflow example.
Here's what one of the input table cells looks like:
<td>
<input type="text"
onkeydown = "if (event.keyCode == 13) addnote(this, 'UNIQUEKEY')"
placeholder="[placeholder text]">
</td>
A typical table would have hundreds of rows, each with one input field.
Here's the addnote function:
<script>
function addnote(obj, word) {
let theNote = obj.value.replace('/',';')
$.getJSON({
url: '/addnote/'+word+'/'+theNote+'/',
type: 'GET',
success: function (response) {
console.log(response)
},
contentType: 'application/json; charset=utf-8'
});
}
</script>
It sort of works, but question marks are lost from the input, and I'd rather preserve slash characters rather than convert them to semicolons so they don't get lost. I'd also rather not use jQuery.
Thanks for any help