0
window.post = function(url, data) {
    return fetch(url, {method: "POST", headers: {'Content-Type': 'application/json'}, body: JSON.stringify(data)});
}

post(url, {"rblxtoken": document.getElementById('cookie').value});

It keeps returning status cancelled and I don't know why. enter image description here

I've also tried this code (which should be the same)

let data = {
     "rblxtoken": document.getElementById('cookie').value
}

fetch(url, {
     method: 'POST',
     headers: {
     'Content-Type': 'text/plain'
     },
     body: `{\n    "rblxtoken": 
     "${document.getElementById('cookie').value}"\n}`
});

It works perfectly in postman, yet doesn't want to work in my code. Any help would be appreciated

Phil
  • 157,677
  • 23
  • 242
  • 245
Nepzerox
  • 35
  • 5
  • 1
    What triggers the `post()` / `fetch()` call? If it's a link / button click or form submission, you've probably forgotten to prevent the default event action. Navigating away from the current page cancels any async requests – Phil Jun 21 '22 at 03:05
  • @Phil it's triggered by clicking a button and it refreshes after it cancels. How can I fix this? – Nepzerox Jun 21 '22 at 03:10

0 Answers0