Reputation: 1889
I have to send an authenticity token with jqgrid
edit url
. The problem is the url
and parameter have different values.
Started POST
"/users-jqedit/?authenticity_token=hSn3r02sT3w15HY+dNjpYvUuXxWclpXz
RKJnfMBJSkQ="
but the parameter is
Parameters:{"authenticity_token"=>
"hSn3r02sT3w15HY dNjpYvUuXxWclpXzRKJnfMBJSkQ="}
resulting in a Can't verify CSRF token authenticity error.
Any clues? here is the code
$(function () {
$("#list").jqGrid({
url:'/users-jq',
editurl:"/users-jqedit/?authenticity_token=<%=form_authenticity_token.to_s%>",
Upvotes: 0
Views: 47
Reputation: 221997
If I correctly understand your problem then you need use
editurl: "/users-jqedit/?authenticity_token=" +
encodeURIComponent("<%=form_authenticity_token.to_s%>"),
instead of
editurl:"/users-jqedit/?authenticity_token=<%=form_authenticity_token.to_s%>",
Upvotes: 1