0

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)

dinotom
  • 4,990
  • 16
  • 71
  • 139
  • Make it sticky (timeouts set to 0 and extended timeout too). Then go to the dev tools and look for the element. Make sure its actually visible. Might be covered. Is it? – John Papa Apr 25 '14 at 00:38
  • I set the timeout to 30 seconds, and the css to display in center of page. That works in all places except the .fail() part of the code. There must be something in that function blocking it? but yet alert("alert something"); works – dinotom Apr 25 '14 at 13:09

0 Answers0