1. 設置瀏覽器安全屬性,啟用【通過域訪問數據源】選項,如圖:
2.調用ajax方法時,設置crossDomain為相反的值。原文鏈接:https://bugs.jquery.com/ticket/12097
<!DOCTYPE html> <html> <head> <title>jQuery CORS in IE7 - IE10</title> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script> $(document).ready(function() { $.ajax({ url: "http://dreamfactorysql.cloudapp.net/API/index.php", dataType: "text", async: true, type: 'GET', cache: false, crossDomain: true == !(document.all), success: function(txt) { alert(txt); } }); }); </script> </head> <body> IE7 thru IE10 CORS Example Using jQuery </body> </html>