HI there!
I am trying to send Json data through NFetch, it work finw with the ‘POST’ req,
but when i change the req to ‘PUT’, seem like the testPutJSONResponse function is not running,
no data is upload to server and ‘POST JSON success’ is not shown in notch log too.
*i only now testing in notch editor environment
Could someone please help me !!! THanks!!!
Below is the code:
function Update()
{
payload = {
“mydata”: “is awesome”,
“myNumber”: 42
}
req = { method: ‘PUT’, body: JSON.stringify(payload), headers: { ‘Content-Type’: ‘application/json’ } };
NFetch(“Myserverlink/” + “userName”+ “.json”, req, testPutJSONResponse);
Log(‘test’);
}
function testPutJSONResponse(response) {
if (response.ok && response.status === 200) {
Log(‘POST JSON success’);
}
}