title: How to check return value using jquery ajax in codeigniter
body: <p><strong>I have this code IN JS:</strong></p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $('.select_vendor').bind('change', function(){
          var vendor_no = $('#vendor_no').val();
  
          $.ajax({
              cache: false,
              type: 'GET',
              url: '&lt;?php echo site_url($this-&gt;uri-&gt;segment(1).'/check');?&gt;',
              data: {vendor_no: vendor_no},
              success: function(data) {
                  if (there is data returned by function) {
                      $('#show_orders').html(data); 
                  } else {
                      alert('No Data!');
                  }
              }
          });
      });
  });
  </code></pre>
  
  <p></p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>function check() {
      $this-&gt;load-&gt;model('vendor_model');
  
      $data = $this-&gt;vendor_model-&gt;CheckVendor($this-&gt;input-&gt;get('vendor_no'));
  
      $this-&gt;load-&gt;view('show_items',$data);
  }
  </code></pre>
  
  <p>if there is data returned by the function, i want to display the data, else show alert message. How to check if data contains values? thanks.</p>