title: jQuery autocomplete ajax TypeError
body: <p>Not sure why I continue to get this error when trying to implement autocomplete with ajax source. </p>
  
  <pre><code>"Uncaught TypeError: Cannot read property 'length' of undefined" 
  </code></pre>
  
  <p>Here is my route in express.</p>
  
  <pre><code>exports.findAllIrds = function(req, res) {
      var name = req.query["value"];
      db.collection('employees', function(err, collection) {
          if (name) {
              collection.find({
                  "value": new RegExp(name, "i")
              }, {
                  value: 1,
                  data: 1,
                  _id: 0
              }).toArray(function(err, items) {
                  res.jsonp(items);
                  //console.log(req.query);
                  //console.log(items);
              });
          } else {
              collection.find().toArray(function(err, items) {
                  res.jsonp(items);
                  console.log(req.query);
              });
          }
      });
  };
  </code></pre>
  
  <p>If I browse to /receiversjson I get all my json as expected and when I browse /receiversjson?value=293589324 I get </p>
  
  <p><code>[{"value": "2935893244","data": "D33HL3RH311911"}]</code> as expected.</p>
  
  <p>However when I try jquery autocomplete with the following code I get error.</p>
  
  <pre><code>$('.item-name textarea').autocomplete({
      serviceUrl: '/receiversjson',
      paramName: 'value',
      autoSelectFirst: true,
      onSelect: function(suggestion) {
          alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
      }
  });  
  
  
  
  Uncaught TypeError: Cannot read property 'length' of undefined
  </code></pre>
  
  <p>In chrome developer tools network tab I see "receiversjson?value=293589324" and when I click on it it open a page with my json.</p>
  
  <pre><code>[{
      "value": "2935893244",
      "data": "D33HL3RH311911"
  }]
  </code></pre>
  
  <p>What am I missing or doing wrong?</p>
  
  <p><img src="https://i.stack.imgur.com/X36yJ.png" alt="enter image description here"></p>