gpt4 book ai didi

javascript - Ajax.Request 与 Prototype onComplete 导致请求不会发生

转载 作者:行者123 更新时间:2023-12-02 20:27:58 25 4
gpt4 key购买 nike

我在使用 Prototype 的 Ajax.Request 时遇到一些问题,如果我执行以下操作,甚至不会发出请求:

<input name="Update" onclick="var req = new Ajax.Request('/agent/reports/update_chart', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form), onComplete:function(transport) {alert("TEST");}}); return false;" type="button" value="Update" />

但是,如果我像这样删除 onComplete,它将发出请求:

<input name="Update" onclick="var req = new Ajax.Request('/agent/reports/update_chart', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)}); return false;" type="button" value="Update" />

我在这里缺少什么?我使用的是原型(prototype) 1.5.0。

最佳答案

alert("TEST") 中的双引号会导致 HTML 语法错误,您需要在此处使用单引号

关于javascript - Ajax.Request 与 Prototype onComplete 导致请求不会发生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4550595/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com