I am just testing out toastr and it seems cool. A much better more stylish way of alerting users. I am trying to using in place of javascript alerts in the .fail portion of my .wehn functions as shown below;
$.when(chartData.GetIntradayData(symbol, 5, true))
.done(function (data) {
$.when(chartData.GetSymbolType(symbol))
.done(function (symbtype) {
symbtypeId = symbtype;
$.when(chartData.GetSingleRangeProjection(symbtypeId, symbol, requestDate))
.done(function (projdata) {
//display the chart and the additional series
})
.fail(function (jqXhr, textStatus, errorThrown) {
// alert("Error downloading projection data: " + textStatus + " Error: " + errorThrown);
toastr.warning('Error downloading projection data: ' + textStatus + ' Error: ' + errorThrown);
});
})
.fail(function (jqXhr, textStatus, errorThrown) {
alert("Error retrieving symboltype: " + textStatus + " Error: " + errorThrown);
});
})
.fail(function (jqXhr, textStatus, errorThrown) {
alert("Error downloading price data: " + textStatus + " Error: " + errorThrown);
});
In the first .fail(), the alert works fine when the function fails. If I comment out the alert and just leave the toastr, it never displays. toastr works in other standard events (click, change, dom ready etc)