XMLHttpRequest POST 传数组参数


传数组参数:xhr.send(JSON.stringify(Array))

  const xhr = new XMLHttpRequest();
  xhr.open('POST', '/test', true);
  // 设置请求头要放在 open 和 send 之间
  xhr.setRequestHeader('content-type', 'application/json');
  xhr.onreadystatechange = () => {};
  xhr.send(JSON.stringify([1, 2, 3]));