0

I've just realized that my code doesn't work in IE for some reason. Its working fine even in IE on www.wowphonefinder.com, but the idea of the AJAX function is to have control under the content of the menu even on our partners side (www.wirefly.com/...). Even when I put the file on some other location then (wowphonefinder.com) its working perfectly fine in all browsers except IE which keeps returning ,,undefined", but not throwing any error or warning on console. Also I have this line in giveMenu.php ,,header('Access-Control-Allow-Origin: *');" that should allow me to use that file from different server.

Here is the code:

function dajMeni()
  {      
     var url = 'http://www.wowphonefinder.com/AJAX/giveMenu.php';     
      $.ajax({
                type: "POST", url: url,
                complete: function(data){
                    alert(data.responseText);
                $("#menu").html(data.responseText);
                }
            });
  }

Hope that my question was clear enough. Thanks in advance for your smart answers! :)

hjuster
  • 3,985
  • 9
  • 34
  • 51

1 Answers1

0

You can't use AJAX on cross sites, have a look at JSONP. (duplicate question: Cross-Domain Requests with jQuery )

Community
  • 1
  • 1
Gregor
  • 4,306
  • 1
  • 22
  • 37
  • Don't get it ... How comes that its working fine in all other browsers then IE? Example - http://www.clinicbeauty.co.uk/template.html .Do you think that returning a JSON object will resolve my problem? – hjuster Jan 26 '12 at 15:24
  • Btw, i have this line ,,header('Access-Control-Allow-Origin: *');" in the php file. That should allow me to use the file from different server. Right? – hjuster Jan 26 '12 at 15:37
  • Thats it! Tnx for you answer. JSONP works great both in IE and in all other browsers! – hjuster Jan 26 '12 at 17:24