Add key to hash if condition is true
<p>I've got this code:</p>

<pre><code>function myFunction(serializeData, extraSerializedData){
  //serializeData is boolean
  var    formSerializedData = '';
  if(serializeData){
      var formSerializedData = $("#myform").serialize();
      if (typeof extraSerializedData !== 'undefined'){
        formSerializedData += extraSerializedData;
      }
    }

    $.ajax({
      type: "get",
      url: "/123",
      data: formSerializedData, //TODO!!!       
      success: function(data){
        //......
</code></pre>

<p>I want to add the <code>data</code> key only if <code>serializeData</code> exists. Is it possible and how to do this in a way that the code remains "beautiful"?</p>
