开发者

Ajax.Request with Prototype onComplete causing the request not to happen

I am having some problems with Prototype's Ajax.Request, if I do the following, the request won't even be made:

<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" />

But, if I remove the onComplete, like so, it will make the request:

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

What am I missing here? I am using Prototype 1.5.0.


The double quotes in the alert("TEST") make an HTML syntax error, you need to use single quotes here


Replace double quotes in your alert statement with single quotes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜