title: How to implement conditional render in JS?
body: <p>Below is the JS (jQuery) code of autocomplete's result function. You can see there's some lines where I print out <code>&lt;li&gt;</code>s containing some <code>data</code> properties (that come in as a result of automcomplete's AJAX call).</p>
  
  <p>How could I rewrite this so that <code>&lt;li&gt;</code> would be conditionally rendered based on whether the property contains any value being either <code>int</code> or <code>string</code> (not empty string or whitespace) or something else that can be represented as <code>string</code>?</p>
  
  <pre><code>$(".clients-dropdown").result(function (event, data, formatted) {
      if (data) {
          // set the hidden input that we need for Client entity rematerialize
          $(".client-id").val(data.client_id);
          if (data.ClientName &amp;&amp; data.Address1 &amp;&amp; data.postalcode &amp;&amp; data.postname) {
              $(".client-address").html(
                      "&lt;li&gt;" + data.ClientName + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.Address1 + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.postalcode + " " + data.postname + "&lt;/li&gt;"
              );
              $(".client-details").html(
                      "&lt;li&gt;" + data.PrettyId + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.VatNo + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.Phone + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.Mobile + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.Email1 + "&lt;/li&gt;" +
                      "&lt;li&gt;" + data.Contact + "&lt;/li&gt;"
              );
          }
      }
  </code></pre>
  
  <p>Also, for the AJAX call, should my server side action return <code>null</code> when there's a <code>null</code> for a property in the database or empty string?</p>