我想每次我更新成功時調用的函數。更新正在進行中,我唯一關心的是每次成功更新時的警報彈出窗口。如何調用javascript中的函數?
$.post(
{
url: 'update_question.php',
data:
{
id: id,
new_question: newText,
},
success: function()
{
that.replaceWith("<section>"+newText+"</section>");
if(text != newText)
{
popup();
}
}
});
var popup = function() {
$(document).ready (function(){
$("#myWish").click(function showAlert() {
$("#success-alert").alert();
$("#success-alert").fadeTo(2000, 500).slideUp(500, function(){
$("#success-alert").alert('close');
});
});
});
};
'$(文件)。 ready(function(){..'在網頁的生命週期中僅被調用一次... – Rayon
@RayonDabre我該怎麼做?remove? –
@VanAdrianCabrera你可以像[this](https:// jsfiddle .net/v6tjtrtd/1 /)。 – RRK