我想在我的mvc應用程序中使用toastr。當我從下載的NuGet我發現這兩個文件 添加到我的腳本文件夾無法獲取toast在我的mvc應用程序中工作
toastr.js
toastr.min.js
我加了js文件給我的佈局頁
<script src="~/Scripts/jquery-1.12.4.min.js"></script>
<script src="~/Scripts/toastr.js"></script>
我現在寫了下面的代碼在我的頁面佈局在腳本部分。 當我運行我的應用程序時,沒有任何反應。我錯過了什麼嗎?
$(document).ready(function() {
displayToastr();
});
function displayToastr() {
//alert('yes');
// Display a info toast, with no title
toastr.info('Hi Mahedee, This information for you.');
// Display a warning toast, with no title
toastr.warning('Hi Mahedee, This the first warning for you!');
// Display a success toast, with a title
toastr.success('Yes! You have successfully completed your task!', 'Congratulation for you, Mahedee!');
// Display an error toast, with a title
toastr.error('An error occured in the solution!', 'Please contact with system administrator.');
}
這是我的解決方案。我錯過了css文件,當我添加它時,一切都開始奏效。 – user2320476