Can Survey 123 support XMLHTTP Post?
Thanks
Hello @JohnLucotch2,
You can send a POST request using xmlhttp in a custom JavaScript function. The important thing to note is asynchronous calls are not supported so you will need to set the async parameter to false when making the request.
I get all that teach a man to fish, but for those of us in a bind, here is the code:
function settime(objectid, schedulechange, mtoken){
let layerURL = `https://services.arcgis.com/`;
let formParams = `f=json&rollbackOnFailure=true&token=`+ mtoken +`&features={
"attributes": {
"OBJECTID":` + objectid + `,
"Instructions":` + schedulechange + `
}
}`
let http = new XMLHttpRequest();
http.open("POST", layerURL, false);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
//Call a function when the state changes.
http.onreadystatechange = function() {
if (http.readyState == 4 && http.status == 200) {
console.log(http.responseText);
};
http.send(formParams)
console.log("Layer done");
Any chance you can share the code you are using. I am having a hard time achieving the same and have no luck finding samples. Thanks.
Thanks that is what I was missing.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.