How to write optional parameter in $.getJSON
<p>I used $.getJSON to retrieve the data from my database. If the parameter dID is not null, then there is one parameter like : </p>

<pre><code>$.getJSON(urlGetProByDep, { depID: dID }, function (data) {
   //blah blah blah                    
});
</code></pre>

<p>But if both dID and cID are not null so the function will use 2 parameter as below :</p>

<pre><code> $.getJSON(urlGetProByDep, { depID : dID,catID : cID }, function (data) {
   //blah blah blah                    
 });
</code></pre>

<p>Could anyone tell me how can I change the paramter in {....} due to the value of dID and cID.</p>

<p>Thanks so much.</p>
