2014-04-16 29 views

回答

1

我希望我會注意到這個ealier。如果您仍然在使用我的插件,那麼您將如何調用它。

您也可以在我的Bootstrap Growl Website(最新版)插件

找到文檔和示例,如果使用的版本1.0.6,並希望只顯示一條消息。

var request = $.ajax({...}); 

request.done(function(msg) { 
    $.growl('Successful', { type: 'success' }); 
}); 

request.fail(function(jqXHR, textStatus) { 
    $.growl({ title: 'Request failed: ', message: textStatus }, { type: 'success' }); 
}); 

如果使用版本2.0.0(昨天剛剛發佈)並且想要顯示消息。在這個新版本中,您可以更新咆哮。

var growl = $.growl({ 
        title: 'Please Wait... ', 
        message: 'Updating Database' 
       },{ 
        type: 'info', 
        allow_dismiss: false, 
        delay: 0 
       }), 
    request = $.ajax({...}); 
request.done(function(msg) { 
    // Update growl with success info 
    growl.update('title', 'Success '); 
    growl.update('message', 'Your changes have been saved'); 
    growl.update('type', 'success'); 
    // Since we disabled both the dismiss and delay we have to close 
    // the growl manually. This closes it after 5 seconds. 
    setInterval(function() { 
      growl.close(); 
    }, 5000); 
}); 

request.fail(function(jqXHR, textStatus) { 
    // Update growl with failed info 
    growl.update('title', 'Request failed: '); 
    growl.update('message', textStatus); 
    growl.update('type', 'danger'); 
    // Since we disabled both the dismiss and delay we have to close 
    // the growl manually. This closes it after 5 seconds. 
    setInterval(function() { 
      growl.close(); 
    }, 5000); 
}); 
相關問題