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

  • SEARCH
  • Home
  • 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

I'm submitting a form using an ajax request (POST method), and checking the HTTP
I am submitting a single text area form via :remote => true. It works
I'm having trouble submitting an ajax request. I've tried to set it up pretty
I am currently submitting a simple PHP form via JavaScript using document.add_driver.submit(); This method
simple normal form that's submitting an action. <form id=myAppSearchForm method=get action=<%= search_path %>> <fieldset>
I'm submitting an html form to a mySQL db with jQuery .ajax. When I
I have a form that I'm submitting with AJAX. A user fills out the
I've created a simple upload-form and got a little problem when submitting the data.
Background : I have a simple model form with a image field. class XYZForm(ModelForm):
$(#new_note).submit(); window.location.href='./thankyou.php?usr_id=<?php echo $_SESSION['pid'>'; Hi, this is a simple code for submitting a form

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.