jQuery AJAX function apparently not being called in FB app when using IE

I have an app on Facebook that has a function that posts directly to friends' walls. It runs without any problems in Firefox and Chrome, but refuses to work in IE. This is the only function that won't run in IE and is also the only function whose target is in a different domain.

function post_friends() {
   var ser = $("#wall_form").serialize();
   var spl = ser.split("friend%5B%5D=");

   var token = $("#access").prop("value");
   var youtube = $("#post_youtube").prop("value");
   var shati = $("#share_title").prop("value");

   for (var i = 0; i < spl.length; i += 1) {
      if (spl[i] != "") {
         var lps = spl[i].split("&");
         var lru = "https://graph.facebook.com/" + lps[0] + "/feed";
         var atad = "name=" + shati + "&access_token=" + token;

         //as far as I can tell, this is the only part of the code that refuses to run.
         var poche = $.post(lru, atad, function(msg) {
            hide_black();
         });
      }
   }
}

Is this a domain issue? How do I solve this? Thanks.

Edit:

okay, so it is a domain issue. XDomainRequest is needed, which jQuery doesn't use.

Edit 2:

problem solved.

Answers


IE uses XDomainRequest when performing cross domain requests, which isn't used by jQuery. Instead of using just $.post, the script now checks first if the browser being used is IE and then acts accordingly:

     if ($.browser.msie && window.XDomainRequest) {
        // Use Microsoft XDR
        var xdr = new XDomainRequest();
        xdr.open("post", lru + "?" + atad);
        xdr.onload = function() {
           // XDomainRequest doesn't provide responseXml, so if you need it:
           var dom = new ActiveXObject("Microsoft.XMLDOM");
           dom.async = false;
           dom.loadXML(xdr.responseText);
           hide_black();
        };
        xdr.send();
     }
     else {
        var poche = $.post(lru, atad, function(msg) {
           hide_black();
        });
     }

Need Your Help

add two types of casting into single column

sql sql-server sql-server-2008 casting

I have column called salary in my table. Another table the values are stored like

How to fit ScrollPane into component bounds

javafx javafx-2 javafx-8

I have this ScrollPane which I holds many components. I want to use the ScrollPane into many components with different size.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.