Sending XML post quest failed

I didn’t know if it’s backend or frontend issue well its interrelated, I was trying to send post XML request o the url in the code below it did’t work its just I am new to XML AND I don’t know what’s wrong, thanks

<!DOCTYPE html>
<html>
<body>

<h2>The XMLHttpRequest Object</h2>
<button type="button" onclick="loadDoc()">Request data</button>

<p id="demo"></p>
 
<script>
function loadDoc() {
  const xhttp = new XMLHttpRequest();
  xhttp.onload = function() {
    document.getElementById("demo").innerHTML = this.responseText;
  }
  const data = '<query key="q1" enable-multiple-hits="true">' +
  '<unstructured_citation>Hungate, B. A., &amp; Hampton, H. M. (2012). Ecosystem services: Valuing ecosystems for climate. Nature Climate Change, 2(3), 151-152.
  </unstructured_citation>' +
'</query>'
const url='https://doi.crossref.org/servlet/deposit';
  xhttp.open("POST", url);
  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhttp.send(data);
}
</script>

</body>
</html>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.