0
我想有一个用户点击一个按钮来检查通过API的东西的状态。我究竟做错了什么?按钮来调用Javascript函数和解析JSON API结果
HTML:
<button onclick="myFunction('http://example.com/api')">Try it</button>
JS:
<script>
function myFunction(url) {
$.get(url, function (jQuery.parseJSON(result)) {
alert(result.status);
});
}
</script>