我正在使用直接Web Remoting (DWR) JavaScript库文件,只在Safari(桌面和iPad)中得到一个错误

它说

超过最大调用堆栈大小。

这个错误到底是什么意思,它是否完全停止处理?

Safari浏览器也有任何修复(实际上是在iPad Safari上,它说

JS:执行超时

我认为这是相同的调用堆栈问题)


当前回答

在我的情况下,我得到这个错误的ajax调用和数据,我试图传递的变量没有定义,这是显示我这个错误,但不是描述变量没有定义。我加上定义了变量n的值。

其他回答

在我的例子中,我基本上忘记了获取输入的值。

错误的

let name=document.getElementById('name');
param={"name":name}

正确的

let name=document.getElementById('name').value;
param={"name":name}

在我的例子中,click事件在子元素上传播。所以,我不得不写以下内容:

e.stopPropagation ()

点击事件:

 $(document).on("click", ".remove-discount-button", function (e) {
           e.stopPropagation();
           //some code
        });
 $(document).on("click", ".current-code", function () {
     $('.remove-discount-button').trigger("click");
 });

下面是html代码:

 <div class="current-code">                                      
      <input type="submit" name="removediscountcouponcode" value="
title="Remove" class="remove-discount-button">
   </div>

如果您不小心导入/嵌入了相同的JavaScript文件两次,有时会出现这种情况,值得在检查器的资源选项卡中检查。

在我的例子中,在app。module中。ts,我得到这个错误,因为我在imports和entryComponents中声明了组件。

Example:

import { MyComponent } from '....';

@NgModule({
  declarations: [
    MyComponent 
  ],
  imports: [
    MyComponent  -- > remove this from here!!!!
  ],
  providers: [],
  bootstrap: [AppComponent],
  entryComponents: [MyComponent]
})
export class AppModule { }

检查是否有调用自身的函数。例如

export default class DateUtils {
  static now = (): Date => {
    return DateUtils.now()
  }
}