Skip to content

Added Support for Toast Notifications on AJAX requests made using XMLHTTPRequest and partly for fetch requests

Compare
Choose a tag to compare
@nabinked nabinked released this 03 Feb 07:14
· 208 commits to master since this release
7cc37d4

You can now send toast notifications on AJAX request.

  • Full support for traditional XMLHTTPRequest based AJAX calls #8.
  • Partial support for AJAX calls made using the browser native fetch requests.
    • To show a toast notification on fetch response. You have to handle the response and use JavaScript to show the message. for e.g.
fetch('/Home/Ajax').then(function(response){
	var messages = nToastNotify.toastr.fetchGetMessagesFromResponse(response);
	nToastNotify.toastr.showToasts(messages)
})
  • Minor preparations to support multiple third party library #13 .

Breaking Changes

  • ToastEnums changed to Enums
  • AddToastNotify() method now needs to be used on IMvcBuilder interface. For e.g.
services.AddMvc().AddNToastNotify(new ToastOption()
            {
                ProgressBar = false,
                PositionClass = ToastPositions.BottomCenter
            }, new NToastNotifyOption()
            {
                SuccessMessage = "Overwritten default success message"
            }); ;

Also need to add as middleware in the Configure method.

            app.UseNToastNotify();