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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:59:13+00:00 2026-06-10T23:59:13+00:00

I’ve written a Javascript method that sends a cross-domain POST request from a client-side

  • 0

I’ve written a Javascript method that sends a cross-domain POST request from a client-side browser to our API written in PHP:

$.ajax({
    type:        'POST',
    url:        backend_url,
    data:        postArgs,
    beforeSend:    function( xhr, settings ) {
        xhr.setRequestHeader( 'Connection', 'close' );
    },
    error:        function( xhr, status, errorThrown ) {
        console.log( 'RECONTRIBUTION: Error on AJAX request! status=' + status + ', errorThrown=' + errorThrown + ', statusText=' + xhr.statusText );
        $( '#alert_message' ).showAlertMsg( 'error', 'Oops, we couldn\'t talk to our server!  Please try again in a moment.' );
    },
    success:    function( data, status, response ) {
        //do things
    }
});

Everything works great in Firefox, Chrome, and Safari, but in IE9 I’m running into problems. The first issue was that I was getting a “No Transport” error which I assumed was being caused by IE’s restrictions on cross-domain requests. I got the request to go through by setting jQuery.support.cors to true and by including this plugin, found on a different SO thread: https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/master/jQuery.XDomainRequest.js

Now the request completes, but the API returns an error because the request body is missing.

Working request from Chrome (urls redacted):

POST [backendurl] HTTP/1.1
Host: [backendurl]
Connection: keep-alive
Content-Length: 79
Origin: [frontendurl]
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: */*
Referer: [frontendurl]
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
DNT: 1

action=contributeSong&client=TUNEBOT&iTunes_id=17344380&user_id=&query_id=64600

And a non-working request from IE9:

POST [backendurl] HTTP/1.1
Accept: */*
Origin: [frontendurl]
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: [backendurl]
Content-Length: 0
Connection: Keep-Alive
Pragma: no-cache

The weird part is that I tried to set the Connection header to Close because I read that Keep-Alive sometimes causes problems with internet explorer…but the requests are sending Connection: Keep-Alive anyway. Any ideas? I’ve been tearing my hair out for a couple of days over this.

UPDATE: OK, so after doing some more reading about the XDR Object, I’ve realized that I can’t send custom headers, which explains the Keep-Alive issue. And I looked at the plugin, which wasn’t sending any data to the server (…), so now I’ve got request that APPEARS to be sending data, but still gets the same response…

POST [backendurl] HTTP/1.1
Accept: */*
Origin: [frontendurl]
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: [backendurl]
Content-Length: 79
Connection: Keep-Alive
Pragma: no-cache

action=contributeSong&client=TUNEBOT&iTunes_id=23148795&user_id=&query_id=64612

Adding the cache:false option, as suggested below, doesn’t seem to affect anything. Is Connection:Keep-Alive what’s killing me here?

  • 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-10T23:59:14+00:00Added an answer on June 10, 2026 at 11:59 pm

    Fixed it! The IE9 XDR plugin I downloaded wasn’t sending any data to the server when executing the XDR request, so I added my data to the request and modified my API to parse the $HTTP_RAW_POST_DATA variable as needed. What a pain, I hope IE10 is as revolutionary as it’s made out to be…

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.