Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4533038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:06:19+00:00 2026-05-21T14:06:19+00:00

I am submitting a simple ajax delete request like so: #invitation_actions =link_to delete, invitation_path(invitation),

  • 0

I am submitting a simple ajax delete request like so:

#invitation_actions
  =link_to "delete", invitation_path(invitation), :method=>:delete, :remote=>true, :class=>"remove", :confirm=>'Are you sure you?'

Note that the page that has the request contains the authenticity_token thanks to the csrf_meta_tag tag that is included in all the pages.

When I look in the logs I see that the delete request is missing the authenticity_token:

Started DELETE “/invitations/5” for 127.0.0.1 at 2011-04-22 11:21:21 -0700
Processing by InvitationsController#destroy as
Parameters: {“id”=>”5”}

Now if I remove the “:remote=>:true” from the code, i.e. I do a regular page load the delete works and I see the following in the log file:

Started POST “/invitations/10” for 127.0.0.1 at 2011-04-22 12:52:19 -0700
Processing by InvitationsController#destroy as HTML
Parameters: {“authenticity_token”=>”qlT8uX/WGQeOQSmVZzw1v8rFdSTHDRbzNY0zpSc9mV0=”, “id”=>”5”}

Why is it a DELETE in the AJAX case and a POST in the non AJAX case?
Why the DELETE does not include the authenticity_token?

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:06:19+00:00Added an answer on May 21, 2026 at 2:06 pm

    The first possible cause for your issue (that I can think of) is that if your UJS script is more than a couple of months old you may need to update it to the latest version in order for your application to send the authenticity token with AJAX requests.

    This change in behaviour occurred in February 2011, which meant that all Rails UJS scripts had to be updated:

    http://groups.google.com/group/rubyonrails-security/browse_thread/thread/2d95a3cc23e03665

    The second part of your question asks about the HTTP POST verb being used for a delete when a non-AJAX case. This is because Rails has to simulate REST form handling since browsers don’t implement all 4 HTTP verbs e.g. GET, POST, PUT & DELETE, because these verbs aren’t valid in HTML.

    JavaScript (AJAX) can do the real thing because it controls the headers that are sent to your AJAX endpoint.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know the official method for submitting feedback on C# 4.0 so that
I have a form I am submitting via AJAX (using prototype and the built-in
I'm having trouble with AJAX form submitting on the iphone. I have a search
Im using a simple ajax script to allow users to vote against multiple posts
normally my ajax functions look something like this: function ajaxCallback(url,functionToRun) { if (window.XMLHttpRequest) {//
I am using a simple form and submitting my textbox values to database, <body>
I'm submitting a parameter show_all with the value true . This value isn't associated
When submitting an app to the app store what is the real difference between
When submitting one form from view, how can i also read or have controller
I am submitting a ColdFusion Form and I want to run some JavaScript to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.