From 820015223ee4e623a96697d62c32cfac69bb0ec1 Mon Sep 17 00:00:00 2001 From: Nabin Karki Thapa Date: Thu, 26 Sep 2019 22:06:00 +1000 Subject: [PATCH] update samples --- samples/Noty/Noty.csproj | 8 ++++---- samples/Toastr/Pages/Ajax.cshtml.cs | 4 ++-- samples/Toastr/Pages/Privacy.cshtml | 18 ++++++++++++++---- samples/Toastr/Toastr.csproj | 8 ++++---- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/samples/Noty/Noty.csproj b/samples/Noty/Noty.csproj index 14ad5f7..d2659ca 100644 --- a/samples/Noty/Noty.csproj +++ b/samples/Noty/Noty.csproj @@ -4,12 +4,12 @@ Microsoft.AspNetCore.App - + - + diff --git a/samples/Toastr/Pages/Ajax.cshtml.cs b/samples/Toastr/Pages/Ajax.cshtml.cs index 7ed0a69..e944394 100644 --- a/samples/Toastr/Pages/Ajax.cshtml.cs +++ b/samples/Toastr/Pages/Ajax.cshtml.cs @@ -13,10 +13,10 @@ public AjaxModel(IToastNotification toastNotification) { _toastNotification = toastNotification; } - public JsonResult OnGet() + public JsonResult OnGet(string type) { System.Threading.Thread.Sleep(2000); - _toastNotification.AddSuccessToastMessage("This toast is shown on Ajax request. AJAX CALL " + DateTime.Now.ToLongTimeString()); + _toastNotification.AddSuccessToastMessage($"This toast is shown on Ajax request. Type: {type} " + DateTime.Now.ToLongTimeString()); return new JsonResult(new { ok = true }); } diff --git a/samples/Toastr/Pages/Privacy.cshtml b/samples/Toastr/Pages/Privacy.cshtml index 94624ee..7424137 100644 --- a/samples/Toastr/Pages/Privacy.cshtml +++ b/samples/Toastr/Pages/Privacy.cshtml @@ -13,14 +13,24 @@ window.addEventListener('load', function () { setTimeout(function () { $('#message').text('Making a native fetch request and show notification.'); - fetch('/Ajax').then(function (response) { + fetch('/Ajax?type=fetch').then(function (response) { var messages = nToastNotify.getMessagesFromFetchResponse(response); nToastNotify.showMessages(messages); - $('#message').text('Making a XMLHTTPRequest (AJAX) and show notification.'); + $('#message').text('Making an XMLHTTPRequest (AJAX) and show notification.'); $.ajax({ - url: '/Ajax', + url: '/Ajax?type=xmlhttp', + }).then(function () { + $('#message').text('Again : Making an XMLHTTPRequest (AJAX) and show notification.'); + $.ajax({ + url: '/Ajax?type=xmlhttp' + }).then(function () { + $('#message').text('Again : native fetch request and show notification.'); + fetch('/Ajax?type=fetch').then(function (response) { + var messages = nToastNotify.getMessagesFromFetchResponse(response); + nToastNotify.showMessages(messages); + }); + }) }); - }); }, 2000) }) diff --git a/samples/Toastr/Toastr.csproj b/samples/Toastr/Toastr.csproj index e7af6fe..ff68716 100644 --- a/samples/Toastr/Toastr.csproj +++ b/samples/Toastr/Toastr.csproj @@ -5,12 +5,12 @@ Microsoft.AspNetCore.App - + - +