非同期通信はjQueryのajax関数を使用
var keys = ["arry1","arry2","arry3"]
$.ajax({
url: /url,
type: 'GET',
traditional: true,
data: {
key: keys
},
success: function (data) {
resolve(data);
},
error: function (xhr, status, error) {
reject(error);
}
});
ポイントは
traditional: true,
古いスタイルのクエリ文字列形式でデータをサーバーに送信する際に使用されます。
サーバ側
@GetMapping("/url")
@ResponseBody
public List<String> url(@RequestParam("key") String [] keys) {
// keysを配列データとして受け取れる。
// keys[0]= "arry1", keys[1]= "arry2", keys[2]= "arry3"
return get(keys);
}