0
私はS3Node.jsのresponseTextをどのように処理するのですか?
function myFunction() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
document.getElementById("testing").innerHTML = this.responseText;
}
};
xhttp.open("GET","https://id.execute-api.ap-southeast-1.amazonaws.com/prod/lambdafunction", true);
xhttp.send();
}
でそれを主催している以下のようにJavaScript関数を持っており、このlambdafunction
は私がIDテストとdiv要素が交換されるということであった期待
'use strict';
console.log('Loading function');
exports.handler = (event, context, callback) => {
let response = {
statusCode: '200',
body: JSON.stringify({ error: 'you messed up!' }),
headers: {
'Content-Type': 'application/json',
}
};
context.succeed(response);
//callback(null, context); // Echo back the first key value
//callback('Something went wrong');
};
以下のようNode.js
で書かれていますerror: 'you messed up!
によって何も起こらなかったのですか?どの部分が間違っているのか分かりますか?