function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VDaveVDave 

AJAX Request IE Status 0

I am having trouble getting my Visualforce page to make an AJAX request in IE 10, 11.  Everything works fine in Chrome, and Firefox but in IE 10, 11 I get status 0 when I make a request.  I can't figure out what I am missing. Is there a bug/limitation somewhere that I am unaware of?

Here is the code (http://jsfiddle.net/LmfsY/2/) on jsfiddle showing it works outside of Visualforce.

Here is a  Visualforce page that demonstrates the issue.

<apex:page>
 
  <div class="document">
    <a class="ajax" href="#">Fire an AJAX request</a>
  </div>
 
  <script src="https://code.jquery.com/jquery-latest.min.js"
        type="text/javascript"></script>
  <script>
   $.support.cors = true;
    $(function() {

        $('.document').on('click', '.ajax', function(e) {
            e.preventDefault();
   
            // ajax request
            $.ajax({
                type: 'get',
                url: 'https://cors-test.appspot.com/test',
                dataType: 'html',
                beforeSend: function() {
                    console.log('Fired prior to the request');
                },
                success: function(data) {
                    console.log('Fired when the request is successful');
                    $('.document').append(data);
                },
                error: function (xhr) {
                    console.log('Fired when the request is NOT successful');
                    $('.document').append(JSON.stringify(xhr));
                },
                complete: function(xhr) {
                    console.log('Fired when the request is complete');
                }
            });
   
        });
   
    });
  </script>
 
</apex:page>

In IE the provided visual force page results in {"readyState":0,"status":0,"statusText":"Access is denied.\r\n"}
In Chrome/Firefox the provided visual force page results in {"status":"ok"}
Best Answer chosen by VDave
VDaveVDave
Ok after a ton of work I found the issue. Fyi for ayone else who hits this issue.

You need to enable 'Access data sources across domain' 

1) Select Internet Options
   2) Select the Security Tab
   3) Select Custom level...
   4) Scroll down to Miscellaneous
   5) Find Access data sources across domains
   6) Change the value to Enable

All Answers

VDaveVDave
Ok after a ton of work I found the issue. Fyi for ayone else who hits this issue.

You need to enable 'Access data sources across domain' 

1) Select Internet Options
   2) Select the Security Tab
   3) Select Custom level...
   4) Scroll down to Miscellaneous
   5) Find Access data sources across domains
   6) Change the value to Enable
This was selected as the best answer
Ramon DacumosRamon Dacumos
Spent a week figuring it out. Then I stumble upon your post. Thanks! It worked for me.