Javascript library notes

Some notes on a few popular javascript libraries.


How to get startDate and endDate?

var range = $("#range").daterangepicker();
var start ="daterangepicker").startDate;
var end ="daterangepicker").endDate;



var data = [{label: '4/1', value: 10}, {label: '4/2', value: 14}];
var labels =, function(item) { return item.label; });
var values =, function(item) { return item.value; });

It is especially useful when preparing data for some chart libraries.


How to pass array when using $.get

$.get("/api", {"name[]": ["George", "Jacky"]}, function(data) {});

If you are using Spring MVC for the server side, here is the relative code to receive multiple parameters.

public YourResponseEntity api(@RequestParam("name") String[] names) {
  //deal with names