This is all within Django.
I have a script (let's say script.py) that has a function (let's say function.py), which executes a comparison of two sets, returning a list that contains values that are in one set but not the other.
I have a views.py page that calls the function.py within a view, stores the resulting list in a variable (let's call it result),
I have an HTML template page that the views.py renders. Within this HTML page, I have a table. At the bottom of this page, I have a Javascript section, which contains an Ajax call that takes a user's input of two numbers and upon the clicking of a submit button, returns the "result" via the table.
I can't for the life of me figure out how to render the table with the data from the script. When I run the script, it says in the Javascript console that "result" is not defined. How can I define it?
Here's the code (the Ajax call within the HTML page is at the top and the view that calls the function.py is at the bottom; setlist is the id given to the table within the HTML page that I'd like to render the "result" data in):