title: how to submit form as JSON object
body: <p>what I am doing is creating a form using JSON this form can then be edited a and produce new JSON object. The problem I am having seems to be with getting the form id.
  The code I am using to return a JSON object is:</p>
  
  <pre><code>form = document.forms[0];
  $.fn.serializeObject = function()
  {
      alert("start serializeObject");
      var o = {};
      var a = this.seralizeArray();
      $.each(a, function(){
          if (o[this.name] !== undefined) {
              if (!o[this.name].push) {
                  o[this.name] = [o[this.name]];
              }
              o[this.name].push(this.value || '');
          } else {
              o[this.name] = this.value || '';
          }
      });
      return o;
      alert(o);
  };
  
  $(function() {
      alert("here");
      form.submit(function(){
          result.append(JSON.stringify(form.serializeObject()));
          return false;
      });
  });
  </code></pre>
  
  <p>This just refresh's the pageI am not sure why.
  This program is not on a server and not be used on a server.
  by this I mean It is only every going to be run locally on a local machine, with no apache2 setup.</p>
  
  <p>Thanks.</p>