title: Selected option value sending with ajax
body: <p>I am trying to insert into the database a selected option value and a text input with jQuery but I get a</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected identifier</p>
  </blockquote>
  
  <pre><code>&lt;div class="text-field" id="catUp" &gt;
  
              &lt;form id="upload_category" method="post" &gt;
  
              &lt;div class="text-inside"&gt;
              &lt;select id="select-category"&gt;
                &lt;option value="audio"&gt;Audio,Video&lt;/option&gt;
                &lt;option value="electro"&gt;Electrocasnice&lt;/option&gt;
                &lt;option value="ingrijire"&gt;Ingrijire personala&lt;/option&gt;
                &lt;option value="pc"&gt;PC&lt;/option&gt;
                &lt;option value="telefoane"&gt;Tablete,telefoane&lt;/option&gt;
              &lt;/select&gt;&lt;br&gt;&lt;br&gt;
              &lt;div id="insert-category"&gt;Nume Categorie&lt;br&gt;
              &lt;input type="text" name="input-categorie" /&gt;&lt;br&gt;&lt;br&gt;
              &lt;/div&gt;
              &lt;input type="submit" name="sumit" value="Adauga categorie" id="catButton" class="button"  /&gt;&lt;br&gt;&lt;br&gt;
              &lt;/div&gt;      
  
  
              &lt;/form&gt;
  
      &lt;/div&gt; 
  </code></pre>
  
  <hr>
  
  <pre><code>    $('#upload-category').on('submit', function(){
      var getCategory = '';
      var getCategoryName = $('#insert-category').val();
  
      $('#select-category').change(function(){
          var selectedCat = $('#select-category option:selected');
          getCategoryName = selectedCat;
      })
  
      var items = {
          'categorie': getCategory,
          'nume':getCategoryName
      }
  
      $.ajax({
          url:'category.php',
          type: 'post',
          contentType: 'application/json',
          dataType: 'json'
          data:JSON.stringify(items)
      });
  
  });
  </code></pre>