How to Store a Server Response as a Var In a Post Request?

I want to Store What a server Responses as a var I have Looked around Nothing Seems to Work
Have Any Idea How to i have Researched Around
EDITED PART:(Spoon Feeding is Okay if the solution is Simple otherwise NOT Recommended Walkthroughs Completely Fine and Clear Guides are Fine Just be Clear for the sake of Everyone Reading in the future)

@Boofhead1000 Can you share the code you use to make the POST request?

Please don’t put this on every post you make. Whether you get spoon-fed or not is up to the person who spoonfeeds you, most of us won’t bother. I am always clear and try to do a full walk-through when I send answers, if you don’t believe me, look at my solution posts. If you need more clarification or help when using an answer, just ask, but these people are human and they don’t have all the time in the world to spend on this forum, so they might not have the time so you should do as much research as possible (I haven’t said that you don’t research but try as much as you can to go all around Google to find a solution)


Hey @Boofhead1000, can you rephrase your question and be a bit more specific in what you’re trying to achieve? :slightly_smiling_face:

Here is the Code…

<!DOCTYPE html>
<html lang="en">
      <label for="fname">Auth Token (Password)</label><br />
      /><br />
        style="height:150px; width:500px;"
        placeholder="Place Text being Posted Stuff Being Posted (Max 1900) Use <br> to Go to The Next Line"
      <p id="notice" class="alert"></p>
      <p id="notice2" class="alert2"></p>
      <button onclick="sendMessage()">Post</button>

      function sendMessage() {
        var request = new XMLHttpRequest();
        var fname = document.getElementById("fname").value;
        var issue = document.getElementById("issue").value;


          request.setRequestHeader("Content-type", "application/json");

          var params = {
            pass: "${fname}",
            content: issue
      document.getElementById("notice").innerHTML =
                    "Request Sent Double Check it has Posted Successfully";
                  event.preventDefault();//change this to whatever you want to use

Password is for protection from People so i can Ask for help on code

and @khalby786 What i am Trying to do Is Create a Form That Display the Response from the API After The Success or fail of the request All i need to know is How to Save the Response to a VAR
(I say i am Open to allowing Spoon feeding But only if The Solution is Very Simple Otherwise I do not recommend it, i should be a little more clearer Sorry)
(edit: I edited the Question to be a little more clear Hope that helps sorry yet again)
Edit 2: I am Using a HTML <script> Tag So it is All in One File In case you are asking when you Read This

1 Like

Use the variable request.response

Okay Let me Test it and Get Back to You