title: Send JSON from HTML form with NODEJS backend
body: <p>I haven't done front end HTML since I was 10 and that was drag and drop frontpage stuff. with static pages. As a result I'm really rusty.</p>
  
  <p>What I need to do is put together a web client for a rest API that I wrote in NodeJS. My question is how, do you send a request from a form (say a log in form) to the server where the body of the POST request is a JSON of the email/password?</p>
  
  <p>HTML form:</p>
  
  <pre><code>&lt;form id="loginForm" action="" method="" class="form-horizontal"&gt;
    &lt;fieldset&gt;
          &lt;legend&gt;Log in&lt;/legend&gt;
          &lt;div class="control-group"&gt;
          &lt;label class="control-label" for="email"&gt;Email&lt;/label&gt;
          &lt;div class="controls"&gt;
                  &lt;input type="text" class="input-xlarge" id="email"&gt;
          &lt;/div&gt;
        &lt;/div&gt;
          &lt;div class="control-group"&gt;
              &lt;label class="control-label" for="password"&gt;Password&lt;/label&gt;
          &lt;div class="controls"&gt;
                  &lt;input type="password" class="input-xlarge" id="password"&gt;
          &lt;/div&gt;      
        &lt;/div&gt;
        &lt;div class="form-actions"&gt;
              &lt;button type="submit" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
              &lt;button class="btn"&gt;Cancel&lt;/button&gt;
              &lt;/div&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>