title: Insert a variable into data attribute, AJAX
body: <p>I'm pretty sure this has a simple solution that I'm missing. I have the following ajax script. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  function postForm() {
      var ret = $('#test').val();
      $.ajax({
              type: 'POST',
              url: 'http://10.0.0.8:9000/demo',
              data: '{"name" : '+ret'}',
              contentType: "application/json; charset=utf-8",
  
          })
      }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="ajaxForm" onSubmit="postForm(); return false;"  method="post"&gt; 
          &lt;input id="test" type="text" name="name" value="Hello JSON" /&gt; 
          &lt;input type="submit" value="Submit JSON" /&gt; 
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I've pulled the value of the input with id='test' put it in the ret variable. Then I'm trying to insert it into the data attribute and send it via ajax. I've tried various assortments of quotes and nothing seems to be working.... what am I doing wrong?</p>
  
  <p>Thanks ahead</p>