Javascript 通知超时功能
我有一个按钮,根据某些参数获取图像,成功或失败时,它会输出一个带有闪光消息的范围Javascript 通知超时功能,javascript,jquery,fadein,fadeout,Javascript,Jquery,Fadein,Fadeout,我有一个按钮,根据某些参数获取图像,成功或失败时,它会输出一个带有闪光消息的范围 $.getJSON('<%= EVERCAM_API %>cameras/test.json?' + params.join('&')) .done(function (resp) { console.log('success'); $('#test-error').text('Snapshot successfully retrieved
$.getJSON('<%= EVERCAM_API %>cameras/test.json?' + params.join('&'))
.done(function (resp) {
console.log('success');
$('#test-error').text('Snapshot successfully retrieved');
$('#testimg-add').attr('src', resp.data);
})
.fail(function (resp) {
$('#test-error').text(resp.responseJSON.message);
console.log('error');
})
.always(function () {
l.stop();
clearInterval(interval);
});
});
上面的fadeIn fadeOut代码片段是我从其他地方获得的,我不太确定如何将其写入现有函数中以获得#测试错误淡入淡出。目前,它只输出年龄和停留
有人对我该怎么做有什么建议吗?l和
interval
来自哪里?他们只是在那里启动和停止按钮上显示的ladda滚轮,当它试图获取图像时。
<span id="test-error"><%= flash[:message] %></span>
that.show = function(text) {
clearTimeout(hideHandler);
elem.find("span").html(text);
elem.delay(200).fadeIn().delay(4000).fadeOut();
};