Reputation: 21
I'm taking inputs in a HTML window and storing it in an array using JavaScript. I want to return that array to to my Flask server.
function createTable()
{
var name = new Array();
cn = window.prompt("Input number of features", 1);
for(var c=0;c<cn;c++)
{
fname = window.prompt("Input feature name", 1);
name[c]= fname;
}
}
<form action = "/data", align="center">
<button class="btn btn-success" STYLE="background-color: #800080;" onclick ="createTable()">Enter
Details</button></a>
</form></body>
I'm using the following line to fetch it on Flask:
feature_names = request.form.get("name")
However, it does not seem to be working for me. I want to know if there is a way to get arrays from HTML to Flask.
Upvotes: 1
Views: 672
Reputation: 351
You can use request.form.getlist('name[]')
in your Flask application.
Upvotes: 1