我必须使用一个报告工具(),它提供了在这个报告工具创建的HTML报告中插入自定义脚本的能力。因此,我们应该能够引用像jQuery、jQueryUI这样的JS库,并与它们一起工作。报告工具中的这一功能是正式的,据说他们正在使用需求来处理这个问题。在这种情况下,我们需要尊重的代码模型(来自IBM "api")如下:
define(['https://our_site/someFolder/someResource.js'], function() {
/*
A) - Here, I would expected that any code writ
我正在使用jQuery.Deferred并注册done、fail和then处理程序:
$.when( some_ajax(url) )
.done(function(result){})
.fail(function(){})
.then(function(){}); //just like that, with a single parameter
我发现当我的ajax调用成功时,done和then回调就会按照这个顺序被调用。但是,当ajax失败时,将调用fail回调,但我无法访问then回调。
我已经阅读了jQuery.Deferred文档,但找不到任何关于此行为原
我在用下面的代码,
navigator.camera.getPicture(failed, completed, { destinationType: Camera.DestinationType.DATA_URL });
function completed() {
alert('got it');
}
function failed() {
alert('Failed to get the photo');
}
它总是到达失败函数。我错过什么许可了吗?