• Ramon Dacumos
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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"}
  • April 23, 2014
  • Like
  • 0