Best Practice of Doing API Call from Javascript

Depends on how efficient it is, e.g. you don’t want to send 1000’s of records to the client if there’s only 20 displayed.

filtering on the client side is easy, so there’s no restriction there.

var specialData = data.filter(function(d) {
  return d.category == 'special';
});