sorry if this question is basic but I’m a beginner :(.
I’ve created an array in my html template (via javascript) and user can enter multiple values for this input — how do I then access the array from server side (python Google App Engine?)
Here’s my code from html template
JS:
<script type="text/javascript">
function addSchool() {
var newContent = "<input type='text' name='institution[]'></input>";
$("#providerList").append(newContent);};
HTML:
{% for s in list %}
<div id="institution" name="institution[]">{{s}}</div>
{% endfor %}
<div id="onemore">
<a href='javascript:addSchool()'>Add More Institutions as Providers</a>
</div>
Then my server side retrieving the array – python in Google App Engine: – (which is NOT WORKING) – only retrieves 1st one:
mylist = self.request.get("institution[]")
What am I do doing wrong syntax wise to retrieve the array???
You have to create form elements which can be submitted, like an input, or select option tags.
Or you have to create a json string and post the serialized json (javascript object) as a string.
Or you create your own string by concatenating the list elements and use it as payload for your post.
Example :
Now you can: