title: Jquery - operators in if statement
body: <p>I'm trying to submit a form to a different location depending on which (of two) form fields have been filed in.</p>
  
  <p>It work when both fields have a value but when only one if field has a value it always submits to the suppliers/category/ URL. Here is my code.</p>
  
  <pre><code>$('#suppliersForm').submit(function() {
  
  catVal = $('#category').val()
  keywordVal = $('#keywords').val()
  
  if( $('#category').val() &amp;&amp; $('#keywords').val() ) 
  {
  var searchString = 'http://&lt;cfoutput&gt;#cgi.server_name#&lt;/cfoutput&gt;/suppliers/searchresults/' + catVal + '/' + keywordVal
  window.location.replace(searchString);
  }
  else if( $('#category').val() || $('#keywords').val() )
  {   
  var searchString = 'http://&lt;cfoutput&gt;#cgi.server_name#&lt;/cfoutput&gt;/suppliers/category/' + catVal
  window.location.replace(searchString);  
  }
  else if( $('#keywords').val() || $('#category').val() )
  {   
  var searchString = 'http://&lt;cfoutput&gt;#cgi.server_name#&lt;/cfoutput&gt;/suppliers/keywords/' + keywordVal
  window.location.replace(searchString);  
  }
  return false;
  });
  </code></pre>
  
  <p>Any help would be appreciated</p>