title: jQuery json object if statement
body: <p>I just recently started becoming familiar with JSON and I'm trying to figure out if I can use an IF statement inside of the JSON object. I hope I am referring that correctly.</p>
  
  <p>So, in my code, I am displaying a SELECT and it's OPTION values with JSON, and the issue I am having is IF a value is NULL, display the text NONE.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code> function renderIPIEditView ($td)
   {
     var value = $td.text();
     $td.html(''); // clears the current contents of the cell
     var $select = $('&lt;select class="form-control"&gt;&lt;/select&gt;');
     $td.append($select);
  
     $.getJSON( 'api/inlands.php', function( data )
     {
       $.each(data, function(index, item)
       {  // here is where I think the IF statement should go
         $('&lt;option&gt;').
           attr('value', item.POINT_CODE).
           text(item.FULL_NAME+', ' +item.US_STATE).
           appendTo($select);
       });
  
       $select.val(value);
     });
   }
  </code></pre>
  
  <p>So with the code above, I can display the necessary options value and text.  However, inside the table, there is one record that has a POINT_CODE of NONE, and will list the text FULL_NAME and US_STATE as NULL, NULL on the screen.</p>
  
  <p>I think I need an IF statement right where I listed the comment in the code above, but I am not sure if I can even use an IF statement, let alone how to use it in this case.</p>