0

This is a design question.

I have a dynamically changing list that works by creating DOM elements and populating them with the fields and these list elements can be added and removed. However, I'm not sure how to design the interaction with the backend server through POST/GET requests. If it helps, I'm using mongoDB and python flask.

My problem is that I'm not sure how to, given an list element (a div container as a list element), retrieve sufficient information about said list element to complete the POST/GET requests.

Should I attach additional fields to the div element itself that holds data like name, description, timestamp? Or should I have a JSON object that keeps track of each list element by id (or something) and it's associated identification data? Or should I be doing something else altogether?

As a side node, where can I turn to learn these design/stylistic things? Thanks!

nlsun
  • 381
  • 3
  • 9

1 Answers1

0

That's what forms are for.

<form name="form1" action="index.htm" method="GET">
(put fields here)
<input type="submit" value="Submit"></input>
</form>

Change index.htm to the name of the page. Put any fields you want to pass to a POST/GET request in there. Any input fields with a name attribute should have their value passed. Change GET to POST if that's what you prefer. Then you must use a server side language like PHP to interpret the sent data.

tomysshadow
  • 870
  • 1
  • 8
  • 23
  • I think you misunderstood my question, I'm not having any trouble adding new list elements. However, if I try to make requests based on a selected list element I'm having trouble retrieving the proper data (none of this is inputted, it should be associated with the list element somehow) to send in the POST request. – nlsun May 04 '14 at 05:27