我想在我的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