I tried to write a programm, which takes javascript input and passes it over to python via ajax. Somehow the programm just runs through without noticing the user input. This is the code I have written so far...
$.when(returnText()).done(function(){
})
function returnText(){
let movie = document.getElementById("movie").value; //get user values
let year = document.getElementById("year").value; //get user values
const dict_values = {movie, year} //pass variables into dic
const s = JSON.stringify(dict_values); //convert into JSON
console.log(s);
return $.ajax({
url:"/test",
type:"POST",
contentType: "application/json",
data: JSON.stringify(s)});
}
I also get a faliure message, that says that the "document.getElementById" equals null.