Tag: google closure library

如何添加真实性令牌?

我最近切换到谷歌关闭一个新项目。 我无法在ajax调用中将真实性标记添加到标头中。 我该怎么做? 我的Ajax片段(使用goog.net.XhrIo类): var initialHTMLContent = superField[i].getCleanContents(); var data = goog.Uri.QueryData.createFromMap(new goog.structs.Map({ body: initialHTMLContent })); goog.net.XhrIo.send(‘/blogs/create’, function(e) { var xhr = /** @type {goog.net.XhrIo} */ (e.target); alert(xhr.getResponseXml()); }, ‘POST’, data.toString(), { ‘Accept’ : ‘text/xml’ }); 在后端使用导轨。 更新: 日志: Processing BlogsController#create (for 127.0.0.1 at 2010-06-29 20:18:46) [PUT] Parameters: {“authenticity_token”=>””} ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): Rendered rescues/_trace (272.4ms) Rendered […]