```
function injectCode(code) {
  const xhr = new XMLHttpRequest();
  const url = "your-rest-api-url";
  xhr.open("POST", url, true);
  xhr.setRequestHeader("Content-Type", "application/json");
  xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
      // code injection successful
    }
  };
  const data = JSON.stringify({ code: code });
  xhr.send(data);
}
```
function injectCode(code) {
  const xhr = new XMLHttpRequest();
  const url = "your-rest-api-url";
  xhr.open("POST", url, true);
  xhr.setRequestHeader("Content-Type", "application/json");
  xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
      // code injection successful
    }
  };
  const data = JSON.stringify({ code: code });
  xhr.send(data);
}