function getBeerById(id, callback) { // 使用ID来请求数据,然后返回数据. asyncRequest('GET', 'beer.uri?id=' + id, function (resp) { // callback调用 response callback(resp.responseText); }); } var el = document.querySelector('#test'); el.addEventListener('click', getBeerByIdBridge, false); function getBeerByIdBridge(e) { getBeerById(this.id, function (beer) { console.log('Requested Beer: ' + beer); }); }