rails ajax post not saving session variables -
controller not updating session params when responding ajax request. spent hour on , still have no idea why happening. have missed super important ajax?
crontroller logs being hit , changing session var
def update if params["commit"] == "generate validation code" rails.logger.info "session before: #{session[:last_validation]}" session[:last_validation] = time.now.to_i rails.logger.info "session after: #{session[:last_validation]}" end end
non-ajax request - session var updated , saved correctly
<%= form_for @ignindex |t| %> <%= t.submit "generate validation code", class: "btn btn-large btn-primary" %> <% end %>
ajax request - controller shows session var updated, never gets saved?
$.ajax({ url: "/ignindices/" + $("#ign").data("id"), type: "put", data: {"commit" : "generate validation code" }, datatype: "json", success: function(data) { console.log("it submitted!"); } });
Comments
Post a Comment