0

在 Firefox 中,这很好用 - toastr ( https://github.com/CodeSeven/toastr ) 显示成功和错误消息。在 IE 中,没有错误,也不显示消息。我如何调用 toastr 方法有问题吗?

    $.ajax({
                url: '/api/emailtemplate/',
                type: 'POST',
                data: ko.toJSON(self),
                contentType: 'application/json',
                //dataType: 'json',
                success: function (result) {
                    toastr.success('Template was saved successfully!');

                },
                error: function () { toastr.error('Template was not saved.', 'Template         error!'); }
            });
4

4 回答 4

0

这个对我有用。你链接到 toastr 和 css 了吗?我刚刚尝试了这个示例,但为数据传入了 {}(因为我没有你的 self 对象)。这个对我有用。在此处查看 jsbin:

http://jsbin.com/uqudid/1/

于 2013-02-25T02:15:45.973 回答
0

我实际上遇到了同样的问题,即在 IE 中没有显示敬酒。就我而言,问题实际上与 CSS 未加载有关。在 IE 中,我检查了 HTML,可以看到警报的标记在那里,但没有样式。我的应用程序是一个 .NET MVC 应用程序,经过一些测试,我将其范围缩小到 IE 似乎不喜欢我的 toastr.css 文件与其他文件捆绑在一起。一旦我将样式表拉到它自己的包中,一切正常。奇怪的...

于 2014-07-15T15:34:20.597 回答
0

我和@im1dermike 有同样的问题。toast 容器在 DOM 中显示,但 toast 本身没有显示。(您可以检查这是否是您的情况,检查 DOM 并查找容器 div 具有的文本“toast-container”)。

我尝试取消注释 polyfill 行和所有内容,直到我意识到 IE 出于某种原因将 toast 设置为属性“display:none”。

对我有用的只是将其添加到我的 styles.scss 中:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* IE10+ CSS styles go here */

    .toast {
      display: block !important;
    }
}

@supports (-ms-accelerator:true) {


/* IE Edge 12+ CSS styles go here */ 

  .toast {
    display: block !important;
  }
}
于 2020-01-28T12:43:42.497 回答
0

我在 IE11 上遇到了这个问题,对于它工作的所有其他浏览器,我使用的是“positionClass”:“toast-bottom-full-width”。这导致IE上的主要闪烁。我只是将位置保留为默认值(没有指定 positionClass),现在问题已经消失了。

于 2018-04-11T19:39:06.273 回答