Tag: velocity

Velocity – 使用jQuery时如何避免ParseErrorException?

我正在尝试在网页上的某些JavaScript中添加jQuerypost。 整个页面由几个Velocity模板构成。 一切都很好,直到我尝试添加jQuerypost,现在我得到: org.apache.velocity.exception.ParseErrorException: Encountered “,” at line 282, column 24 of /WEB-INF/velocity/www/comments.vm Was expecting one of: “(” … … … ~~~snip~~~ 第282行是$.post(…而第24列似乎是第一个“,”字符。最初我在这一行上有JSON,但是我把它移动到了(我的想法是var myJSONObject …行)与无效JSON相关的错误(行开头的选项卡给出了误导性的列号)。 var myJSONObject = {“body”: “”, “action”: “postcomment”, “submitted”: “true”, “ajax”: “true”}; myJSONObject.body = $(“body”).val(); $.post(“$!{articleurl}”, myJSONObject, function(result){ btn.textContent=’Comment sent successfully.’; }); 次要更新 我改变了以下几行: var url = “$articleurl”; $.post(url, myJSONObject, function(result){ […]