Şu şekilde yapmaya calısıyorum fakat olmuyor. Elimde 1 adet form bulunmaktadır bu formları post edince ilgili URL'ye valueleri post etmesini istiyorum bir türlü yapamadım.

<script>
function SendData() {
  const tkn = document.getElementsByName('tkn').value;
  const http = new XMLHttpRequest();
  const url = 'get_data.php';
  const params = "tkn=" + tkn + "";
  http.open('POST', url, true);

  // Send the proper header information along with the request
  http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

  http.onreadystatechange = function () { // Call a function when the state changes.
    if (http.readyState == 4 && http.status == 200) {
      alert(http.responseText);
    }
  };
  http.send(params);
  console.log(tkn);
}

</script>