jquery dynamic url
<p>I have a form and the url for submitting the form will generated dynamicly </p>

<pre><code>var Var1 = new Array();
var Var2 = new Array();
if(Var1.length === 0)
$(this).attr('action', 'http://localhost/Method' ).submit();
if(Var1.length != 0 &amp;&amp; Var2.length === 0)
$(this).attr('action', 'http://localhost/Method/Var1').submit();
if(Var1.length != 0 &amp;&amp; Var2.length != 0)
$(this).attr('action', 'http://localhost/Method/Var1/Var2').submit();
</code></pre>

<p>and all that URLs fires one method in the server and it is </p>

<pre><code>public function Method(){}
public function Method(Var1){}
public function Method(Var1 , Var2){}
</code></pre>

<p>is there anyway to make all the last 3 methods as one method? something like this:</p>

<pre><code>public function Method(Var1, Var2){
    if(  condition for Var1 ){// doSomthing}
    if(  condition for Var2 ){// doSomthing}
}
</code></pre>
