console
var myService = new BCloud({
serviceId: 'tt553695rb86t93m68',
});
$('#invoke').click(function() {
var fnName = 'hello';
myService.run(fnName)
.then(function(data) {
console.log(data.message);
$('#res').show();
$('#result').html(JSON.stringify(data));
})
.catch(function(error) {
console.log(error);
alert('调用出错')
});
});
<p>轻服务 Hello World 示例</p>
<button id="invoke">调用</button>
<button id="reinvoke">再次调用</button>
<div id="res">
<p>调用成功:</p>
<p id="result"></p>
</div>
#res {
display: none;
}
#reinvoke {
display: none;
}
button {
background-color: #fff;
border: 0;
border-radius: 2px;
box-shadow: none;
color: #1a73e8;
cursor: pointer;
display: inline-block;
font: 500 14px/20px Roboto,sans-serif;
height: 36px;
margin: 0;
min-width: 36px;
outline: 0;
overflow: hidden;
padding: 8px;
text-align: center;
text-decoration: none;
text-overflow: ellipsis;
text-transform: uppercase;
transition: background-color .2s,box-shadow .2s;
vertical-align: middle;
white-space: nowrap;
background-color: #039be5;
color: #fff;
}