]> gitweb.michael.orlitzky.com - dead/census-tools.git/blob - www/maps/maps/public/javascripts/maputils.js
Created a MapUtils object to contain the post_data function.
[dead/census-tools.git] / www / maps / maps / public / javascripts / maputils.js
1 function MapUtils() {
2
3 this.post_data = function(url, data) {
4 /* Create a new form, and add it to the DOM. Then, create a hidden
5 input control as a child of the form which contains the data that
6 we'd like to post. Finally, add the form to the document's body,
7 and submit it. */
8 var new_form = document.createElement("form");
9 new_form.method = "post";
10 new_form.action = url;
11 var new_input = document.createElement("input");
12 new_input.setAttribute("id", "data");
13 new_input.setAttribute("name", "data");
14 new_input.setAttribute("type", "hidden");
15 new_input.setAttribute("value", data);
16 new_form.appendChild(new_input);
17 document.body.appendChild(new_form);
18 new_form.submit();
19 }
20
21 }