Async await new javascript webpage functions replace AJAX

Ok. I got it working. Very simple fetch async programming.

<script>

let myId = "7777777777777777777777"
let myFunction = "doAll"
let myAccessToken = "cfe12f77777777777777777777777777777"
let myParameter = "toggleLED"

let particleApi = "https://api.particle.io/v1/devices"
let myUrl = particleApi + "/" + myId + "/" + myFunction

let myConfig = {
	'headers' : {'Content-Type' :'application/x-www-form-urlencoded'},
	'method' : 'POST',
    'body' : 'args='  + myParameter + '&access_token=' + myAccessToken
}

</script>

<input type="button" value="inline" onclick="{

  (async function () {
      const myResponse = await fetch(myUrl, myConfig)
      document.getElementById('myDiv01').innerHTML = await myResponse.text()
  })()   // end of inline async function

}">

<div id="myDiv01">...</div>




reminder it uses this .ino flashed to the photon


void setup() {
    pinMode(D7, OUTPUT);
    Particle.function("doAll", doAllFunction);   
}

void loop() {

}

int myReturn = 0;

int doAllFunction(String myParams) {
    if  (myParams == "toggleLED"){
        digitalWrite(D7, !digitalRead(D7));
        myReturn = digitalRead(D7);    // just so it is either 0 or 1
        Particle.publish("Received Params: " + String(myParams), "Returned: " + String(myReturn), 60, PRIVATE);  

    } else 
    
    if (myParams == "photoResistor"){
        myReturn = analogRead(A0);   
        Particle.publish("Received Params: " + String(myParams), "Returned: " + String(myReturn), 60, PRIVATE);  
    } else 
    
        {
            myReturn = -1;   // showing an incorrect argument
        }
    return myReturn;                                
}

I saw a post that gets JSON data to send but I could not get it working