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 7695941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:39:50+00:00 2026-05-31T21:39:50+00:00

I am experiencing a weird issue with PUT and POST ajax CORS requests in

  • 0

I am experiencing a weird issue with PUT and POST ajax CORS requests in jQuery when not passing any data parameters.

So I enabled CORS on my server by setting the headers. Everything works fine when I do for example:

$.ajax({
  url: "http://127.0.0.1/R/index.html",
  type: "PUT",
  data: {foo:"bar"}
});

However, when I do the same request without setting the data parameter, firefox returns without ever posting the ajax:

$.ajax({
  url: "http://127.0.0.1/R/index.html",
  type: "PUT"
});

Note that this only happens for the POST and PUT methods, when a full url is specified in the request, and no http data parameters are specified. It also happens when the url is on the same domain as the page itself (hence no CORS is required). It does not happen if I just specify a path in the url, instead of a full url.

Any clues how I can do a POST/PUT without passing any parameters (my server won’t accept ‘fake’ parameters).

  • 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-31T21:39:51+00:00Added an answer on May 31, 2026 at 9:39 pm

    I am pretty sure by now it is a bug in jQuery when it calls the ‘multipart/form-data’ encoder in cross-domain ajax requests for when there is no data posted.

    It can be avoided by using something like this:

    if(jQuery.isEmptyObject(mydata)){
        $.ajax({
            url: "http://127.0.0.1/R/index.html",
            type: "PUT",
            contentType: 'application/x-www-form-urlencoded'
        });
    } else {
        $.ajax({
            url: "http://127.0.0.1/R/index.html",
            type: "PUT",
            data: mydata
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Core Data not saving NSString. Hey all! Currently experiencing a weird issue
I'm experiencing a weird scrollbar issue. I'm building a page that uses jQuery and
I am experiencing a weird issue with the jquery-ui tab object. If I highlight
I'm experiencing a really weird issue which I do not know how to solve.
I'm currently working with jQuery 1.4.2 and jQuery UI 1.8.2. I'm experiencing some weird
Hi I'm experiencing a super weird problem. Whenever I post links to my website
I'm experiencing some weird problems with SESSION variables on my PHP/Ajax online shopping cart.
I'm currently experiencing a weird issue with ASP.NET MVC 3 ListBox validation, as stated
I'm experiencing a weird issue with my sphinx setup in my staging environment where
I'm experiencing a weird issue in which I need to have a default constructor

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.