title: jQuery to Capitalize Ajax property
body: <p>I've been having this problem where in I need to capitalize the text input being sent to ajax before saving it to the database. Basically I need to lowercase the text value and then capitalize the first letter before finally saving it to database.</p>
  
  <p>Here's my take so far:</p>
  
  <pre><code> $('#button').click(function(event) {
  
           event.preventDefault();
  
           $.ajax({
             url: '/categories',
             method: 'post',
             data: {
               category: { name: $('#new-category').val().toLowerCase().css('text-transform', 'uppercase') }
             },
             success: function(category){
                // console.log(response);
                if(category.id != null){
                  let newOption = $('&lt;option/&gt;')
                  .attr('value', category.id)
                  .attr('selected', true)
                  .text(category.name)
  
                  $('#category_select').append(newOption);
                  $('#new-category').val('');
                }
             },
             error: function(xhr){
               let errors = xhr.responseJSON;
             }
  
           });
       });
  </code></pre>
  
  <p>As you can see on this part:</p>
  
  <pre><code>  category: { name: $('#new-category').val().toLowerCase().css('text-transform', 'uppercase') }
                 }
  </code></pre>
  
  <p>This returns an error. How do I do this and jQuery and make sure what is being sent out has the first text in the category name got uppercase or simply capitalize?</p>