ここに私の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 秒間表示されて消えますが、その後、ページが非常に速く上に移動します。この移行をスムーズにしたいfeature
3秒後に消えるdivの上に通知divを重ねることは可能ですか?