Added Support for Toast Notifications on AJAX requests made using XMLHTTPRequest and partly for fetch requests
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 toEnums
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();