JQueryを用いて、トースト通知がしたいのですが、何も表示されません。
chromeのディベロッパーツールで確認したところ、下記のようなエラーが出ていると分かったのですが、どこをどう修正すればいいのか分かりません。
分かりましたら教えていただけると助かります。
↓エラーメッセージ
Uncaught ReferenceError: toastr is not defined
at HTMLDocument.<anonymous> (Osusume_View2:73) at j (jquery.min.js:2) at Object.fireWith [as resolveWith] (jquery.min.js:2) at Function.ready (jquery.min.js:2) at HTMLDocument.K (jquery.min.js:2)
Javascript
1<head> 2<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 3(略) 4<link href="~/Content/jquery.toast.css" rel="stylesheet" /> 5</head> 6<body> 7<script src="~/Scripts/jquery.toast.js"></script> 8<script type="text/javascript"> 9 var msg = "@ViewBag.Message"; 10 if(msg != ""){ 11 $(document).ready(function () { 12 toastr.options.timeOut = 3000; // 3秒 13 toastr.options = { 14 "closeButton": true, 15 "debug": false, 16 "newestOnTop": false, 17 "progressBar": false, 18 "positionClass": "toast-top-center", 19 "preventDuplicates": false, 20 "onclick": null, 21 "showDuration": "300", 22 "hideDuration": "1000", 23 "timeOut": "5000", 24 "extendedTimeOut": "1000", 25 "showEasing": "swing", 26 "hideEasing": "linear", 27 "showMethod": "fadeIn", 28 "hideMethod": "fadeOut" 29 } 30 Command: toastr["success"]("@ViewBag.Message" + "@ViewBag.Message5" + "@ViewBag.Message3"); 31 $('#linkButton').click(function () { 32 toastr.success('click'); 33 }); 34 }); 35 }else{ 36 $(document).ready(function () { 37 toastr.options.timeOut = 3000; // 3秒 38 toastr.options = { 39 "closeButton": true, 40 "debug": false, 41 "newestOnTop": false, 42 "progressBar": false, 43 "positionClass": "toast-top-center", 44 "preventDuplicates": false, 45 "onclick": null, 46 "showDuration": "300", 47 "hideDuration": "1000", 48 "timeOut": "5000", 49 "extendedTimeOut": "1000", 50 "showEasing": "swing", 51 "hideEasing": "linear", 52 "showMethod": "fadeIn", 53 "hideMethod": "fadeOut" 54 } 55 Command: toastr["info"]("@ViewBag.Message" + "@ViewBag.Message5" + "@ViewBag.Message3"); 56 $('#linkButton').click(function () { 57 toastr.success('click'); 58 }); 59 }); 60 } 61 </script> 62(略) 63</body>
回答1件
あなたの回答
tips
プレビュー