I created a Python function named get_maps()
that has 2 arguments, year
and category
and I would like to access it from JS, customizing those 2 arguments. However the code below returns an error:
list is not specified
function onSubmit(e) {
e.preventDefault()
if (year.value === "" || cat.value === "") {
msg.textContent = "Please fill out the fields"
msg.classList.add("error");
} else {
msg.textContent = ""
msg.classList.remove("error");
$.ajax({
type: "POST",
url: "~/mapsinterpeter.py",
}).done(function(o) {
list = get_maps(year.value, mapdict.cat.value)
});
year.value = ""
cat.value = ""
console.log(list)
}
}