user21293
user21293

Reputation: 6469

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)}); return false;" type="button" value="Update" />

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

Upvotes: 0

Views: 858

Answers (2)

Chandu
Chandu

Reputation: 82903

Replace double quotes in your alert statement with single quotes.

Upvotes: 1

Fabien M&#233;nager
Fabien M&#233;nager

Reputation: 140195

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

Upvotes: 1

Related Questions