]> gitweb.michael.orlitzky.com - dead/census-tools.git/blobdiff - 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
index 45f976d30e3332b87fcf6549f1eb0d8539009da0..3d1f2e5cecba3cd9d067f71f1a78aefbaae5a038 100644 (file)
@@ -1,17 +1,21 @@
-function post_data(url, data) {
-  /* Create a new form, and add it to the DOM. Then, create a hidden
-     input control as a child of the form which contains the data that
-     we'd like to post. Finally, add the form to the document's body,
-     and submit it. */
-  var new_form = document.createElement("form");
-  new_form.method = "post";
-  new_form.action = url;
-  var new_input = document.createElement("input");
-  new_input.setAttribute("id", "data");
-  new_input.setAttribute("name", "data");
-  new_input.setAttribute("type", "hidden");
-  new_input.setAttribute("value", data);
-  new_form.appendChild(new_input);
-  document.body.appendChild(new_form);
-  new_form.submit();
+function MapUtils() {
+  
+  this.post_data = function(url, data) {
+    /* Create a new form, and add it to the DOM. Then, create a hidden
+       input control as a child of the form which contains the data that
+       we'd like to post. Finally, add the form to the document's body,
+       and submit it. */
+    var new_form = document.createElement("form");
+    new_form.method = "post";
+    new_form.action = url;
+    var new_input = document.createElement("input");
+    new_input.setAttribute("id", "data");
+    new_input.setAttribute("name", "data");
+    new_input.setAttribute("type", "hidden");
+    new_input.setAttribute("value", data);
+    new_form.appendChild(new_input);
+    document.body.appendChild(new_form);
+    new_form.submit();
+  }
+
 }