title: How to POST this Output to the API
body: <p>Hi i have create a JSON object getting data from a form and now i want to POST that into redmine API. This is what i have done so far. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;script&gt;
  // This is the creation of JSON object 
  $.fn.serializeObject = function()
  {
      var o = {};
      var a = this.serializeArray();
      $.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 {"project":o};
  };
  
  // This is the API linking and POSTING
  
      $(document).ready(function(){
          $("#submit").on('click', function(){
              // send ajax
              $.ajax({
                  url: 'http://localhost/redmine/projects.json', // url where to submit the request
                  type : "post", // type of action POST || GET
                  dataType : 'jsonp',
                  headers: { 'X-Redmine-API-Key': 'admin' }, 
                  data : JSON.stringify($('form').serializeObject()), // post data || get data
                  success : function(result) {
                      // you can see the result from the console
                      // tab of the developer tools
                      alert("Sucess");
                      console.log(result);
                  },
                  error: function(xhr, resp, text) {
                      console.log(xhr, resp, text);
                  }
              })
          });
      });
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action="" method="post"&gt;
  First Name:&lt;input type="text" name="name" maxlength="12" size="12"/&gt; &lt;br/&gt;
  Last Name:&lt;input type="text" name="identifier" maxlength="36" size="12"/&gt; &lt;br/&gt;
  &lt;!-- number:&lt;input type="number" name="number" maxlength="36" size="12"/&gt; &lt;br/&gt; --&gt;
  &lt;textarea wrap="physical" cols="20" name="description" rows="5"&gt;Enter your favorite quote!&lt;/textarea&gt;&lt;br/&gt;
  &lt;p&gt;&lt;input type="submit" /&gt;&lt;/p&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The post doesn't work. JSON object is created well, Passing that to API is the problem. I think problem is here,</p>
  
  <pre><code>data : JSON.stringify($('form').serializeObject()),
  </code></pre>
  
  <p>How do i pass the created JSON Object above to data. Thanks</p>