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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:29:46+00:00 2026-06-14T20:29:46+00:00

I want to do a cross-domain GET ajax request using jQuery v1.8.3. Here is

  • 0

I want to do a cross-domain GET ajax request using jQuery v1.8.3.

Here is my setup:

  1. I have a server on domain1.dev which issues these CORS headers for each requests:

    • Access-Control-Allow-Origin: *
    • Access-Control-Allow-Credentials: true
    • Access-Control-Allow-Methods: *
    • Access-Control-Allow-Headers: *
  2. I have a web application on domain2.dev which load a javascript from domain1.dev called domain1.js.

    In this domain1.js file, I issue this AJAX request:

    jQuery.ajax('http://domain1.dev/path', {
        headers: {'Accept': 'application/json'},
        xhrFields: {
            withCredentials: true
        },
        statusCode: {
            200: function(data, textStatus, jqXHR) {
                // some logic
            },
            401: function(data, textStatus, jqXHR) {
                // some other logic
            }
        }
    })
    
  3. I load the page from domain2.dev. The AJAX request is issued (without preflight) and is successfull (status code 200) BUT firebug still displays it in red (chrome says “cancelled”) and I don’t understand why.

Any idea?

EDIT:

Response headers sent by the domain1.dev:

Access-Control-Allow-Cred...    true
Access-Control-Allow-Head...    Accept, Accept-Encoding, Accept-Language,    Connection, Cookie, Host, Origin, Referer, User-Agent
Access-Control-Allow-Meth...    GET
Access-Control-Allow-Orig...    *
Cache-Control   private
Connection  keep-alive
Content-Type    application/json
Date    Thu, 22 Nov 2012 22:24:44 GMT
Server  nginx/1.2.3
Transfer-Encoding   chunked
X-Powered-By    PHP/5.4.6
x-debug-token   50aea62c91ee6

while the request headers were:

Accept  application/json
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection  keep-alive
Cookie  obfuscated=uk40mmmqbffues5cpn6omj6mf0; __utma=126865951.1486960365.1353615466.1353615466.1353619027.2; __utmz=126865951.1353615466.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=126865951
Host    domain1.dev:8080
Origin  http://domain2.dev:8080
Referer http://domain2.dev:8080/app_dev.php
User-Agent  Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Firefox/17.0
  • 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-06-14T20:29:48+00:00Added an answer on June 14, 2026 at 8:29 pm

    At the backend, you must explicitly state which headers and methods you want to allow. The Access-Control-Allow-Methods and Access-Control-Allow-Headers response headers do not support wildcards.

    If you want to allow any method / header, just look for the Access-Control-Request-Methods and Access-Control-Request-Headers headers in the (preflight) request, and return the literal value.

    And, you cannot use a wildcard for Access-Control-Allow-Origin when withCredentials is true. Either use the same mechanism as described earlier to simulate the wildcard, or don’t use withCredentials.

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

Sidebar

Related Questions

Possible Duplicate: is it possible to get cross domain SOAP request using jquery please
I want to do a post cross-domain request , I use a form which
I have two shapes which are cross sections of a channel. I want to
I am making a cross domain AJAX request, and because of this, I can't
I have used ajax with jquery 1.4.2 on my domain, but I need to
I want to use jQuery's ajax call with type 'GET' against my RESTful API
I have an existing jQuery plugin which makes a lot of AJAX calls (mostly
I am developing a cross-domain RPC library for which I want to do some
I want to make Cross domain REST web services with CORS(Cross-Origin Resource Sharing). I
I want to develop cross platform mobile app. I have seen frameworks listed below

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.