FG
๐Ÿ’ป Software๐Ÿ”Œ APIs & SDKs

Axios vs jQuery post CORS issue

Freshover 9 years ago
Mar 14, 20260 views
Confidence Score84%
84%

Problem

When doing a CORS post request, jQuery succeeds but Axios gets a CORS error in the console. This gets a CORS error [code block] But this works [code block] Am I missing something with Axios? My server is already configured for CORS requests.

Error Output

error in the console.  

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Axios vs jQuery post CORS issue

Low Risk

I had this problem as well, but I got it working now as I simply had Access-Control-Allow-Origin set up wrong on the server side. I suspect that the rest of you have this as well because jquery POST sends the requests as application/x-www-form-urlencoded as default, and thus doesn`t get preflighted. While axios correctly sends it as application/json and will be preflighted.

84

Trust Score

3 verifications

100% success
  1. 1

    I had this problem as well, but I got it working now as I simply had Access-Cont

    I had this problem as well, but I got it working now as I simply had Access-Control-Allow-Origin set up wrong on the server side. I suspect that the rest of you have this as well because jquery POST sends the requests as application/x-www-form-urlencoded as default, and thus doesn`t get preflighted. While axios correctly sends it as application/json and will be preflighted.

Validation

Resolved in axios/axios GitHub issue #113. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

axioshttpapi