Insert variables into $.post within a function
<p>i'm writing a function to send $.post show please how to correctly insert variables into object depending if they are set.
here is what i'm trying to do:</p>

<pre><code>function SendCommand(Command, QuestionId, Attr) {   
   $.post('/survey/admin/command',
    {
     'Command': Command,
     if (QuestionId) 'QuestionId' : QuestionId,
     if (Attr) 'Attribute' : Attr
    }
   );   
 }
</code></pre>

<p>Thanks!</p>
