jqgrid中发送参数的难度

时间:2015-04-21 10:32:32

标签: html jqgrid

我必须使用jqgrid编辑url发送真实性令牌。问题是url和参数具有不同的值。

开始发布

"/users-jqedit/?authenticity_token=hSn3r02sT3w15HY+dNjpYvUuXxWclpXz
RKJnfMBJSkQ="

但参数是

Parameters:{"authenticity_token"=>
"hSn3r02sT3w15HY dNjpYvUuXxWclpXzRKJnfMBJSkQ="}

导致无法验证CSRF令牌真实性错误。

任何线索?这是代码

$(function () {
 $("#list").jqGrid({
       url:'/users-jq', 
       editurl:"/users-jqedit/?authenticity_token=<%=form_authenticity_token.to_s%>",

1 个答案:

答案 0 :(得分:1)

如果我正确理解您的问题,那么您需要使用

editurl: "/users-jqedit/?authenticity_token=" +
    encodeURIComponent("<%=form_authenticity_token.to_s%>"),

而不是

editurl:"/users-jqedit/?authenticity_token=<%=form_authenticity_token.to_s%>",
相关问题