DocumentServer
DocumentServer copied to clipboard
[Custom Functions] XMLHttpRequest does not work
This issue is unique.
- [X] I have used the search tool and did not find an issue describing my bug.
Operating System of DocumentServer
Docker
Version information
8.1.1.27
Expected Behavior
New feature in 8.1. Expected to obtain value from XMLHttpRequest responseText
field after calling send()
method. The testfn()
function works correctly in Chrome browser console.
Actual Behavior
#VALUE
shown in cell.
Reproduction Steps
- Create a new custom function (Plugins -> Macros -> Custom functions) and paste the following:
(function()
{
/**
* Function that returns 69
* @customfunction
* @returns {any} 69.
*/
function testfn() {
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://httpbin.org/get?a=69', false);
xhr.send();
return JSON.parse(xhr.responseText).args.a;
}
Api.AddCustomFunction(testfn);
})();
- In an empty cell, type
=TESTFN()
Additional information
No response