我的问题是网页中没有显示s3存储桶名称。我的代码如下:
var AWS = require(['aws-sdk-2.1.34.min.js']);
var app = {
initialize:function(){
this.bindEvents();
},
bindEvents: function(){
document.addEventListener("deviceready", this.onDeviceReady,false);
},
onDeviceReady: function(){
AWS.config.update({accessKeyId:'MY ACCESS KEY', secretAccessKey:'MY SECRET KEY'});
var s3Client = new AWS.S3();
console.log("s3 :: ",s3Client);
s3Client.listBuckets(function(err, data){ alert(345);
if(err) alert("Error :: ", err);
else{
var listElement = document.createElement("ul");
document.getElementById('bucket_list').appendChild(listElement);
for(var index in data.Buckets){
var bucket = data.Buckets[index];
var listContent = document.createElement("li");
listContent.innerHTML = "<p> Bucket Name: " + bucket.name + "</p>";
listElement.appendChild(listContent);
}
}
});
}
};
app.initialize();
我无法弄明白为什么。