这是我的ajax
电话
// send the data to the server using .ajax() or .post()
$.ajax({
type: 'POST',
url: 'addVideo',
data: {
video_title: title,
playlist_name: playlist,
url: id
// csrfmiddlewaretoken: '{{ csrf_token }}',
},
success: function(response, textStatus, jqXHR){
bootstrap_alert.success('video saved successfully');
},
// callback handler that will be called on error
error: function(jqXHR, textStatus, errorThrown){
bootstrap_alert.error('There were some errors while saving the video. Please try in a while');
},
});
和notification
功能
// setting up alerts on action
bootstrap_alert = function() {}
bootstrap_alert.success = function(message) {
$('#feature').prepend('<div id="alert" class="alert alert-success"><!--a class="close" data-dismiss="alert">×</a--><span>'+message+'</span></div>');
$('#alert').fadeOut(3000);
}
bootstrap_alert.error = function(message) {
$('#feature').prepend('<div id="alert" class="alert alert-error"><!--a class="close" data-dismiss="alert">×</a--><span>'+message+'</span></div>');
$('#alert').fadeOut(3000);
}
当我
ajax
调用返回时,我看到一个 div 持续了 3 秒,然后它就消失了,但是我的页面很快向上移动,我想让这个过渡平滑是否可以将通知 div 放在
feature
3 秒后消失的 div 之上?