Pass array from HTML to Django application
I developed an application in JSPs and Servlets involving drop down menus that kept growing with how m开发者_Python百科any authors per publication their were.
This was done in JavaScript and then in my application iterated through them using a loop. Is this possible using Django? This would be useful in my application.
This link might help you out if you don't want to dive into javascript (too much)
http://www.dajaxproject.com/
Or have a look at this stackoverflow question/awnser:
What is the best AJAX library for Django?
In any case, you need to serialize your array to a JSON string. Then pass the JSON with an XMLHTTPRequest (ajax) to the server.
Add the javascript tag to your question if you don't mind more JS solutions. Otherwise look for a Django Ajax framework to do the heavy lifting for you.
精彩评论