Uncaught TypeError: Cannot read properties of undefined (reading ‘items’)

I’m testing the call but I keep getting the error uncaught type Error. it says the error is when i call data.tracks.items.

It says the error is at Object.success, at i, at Object.fireWith, at z, at XMLHttpRequest

  console.log('hello world');

  $('form').submit(function(event) {
    event.preventDefault();
    
    let query = $('input').val();
    let context = $('input[name="context"]:checked').val();
    
    $.get('/search?' + $.param({context: context, query: query}), function(data) {
      $('#results').empty();
      $('input[type="text"]').val('');
      $('input').focus();
      
      data.tracks.items.forEach(function(track, index) {
        let trackSearch = "https://open.spotify.com/track/";
        let newElement = $('<a onClick="getFeatures(&apos;' + track.id + '&apos;)" target="_blank"></a><br>').text(track.name + '   |   ' + track.artists[0].name).attr('href', trackSearch + track.id);
        $('#results').append(newElement);
      });
    });
  });
}); ```