2012-10-20 76 views
0

這裏是我的jQuery AJAX方法,它只適用於Ie,但不適用於Chrome或Firefox。我的代碼是Jquery AJAX方法只適用於IE瀏覽器

<!DOCTYPE html> 
    <html> 
<head> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2">  
</script> 
<script> 
$(document).ready(function() { 
    $("button").click(function() { 
     $.ajax({ 
      url: "http://50.116.19.49/rest/user.json", 
      success: function(result) { 
       $("div").text(result); 
      } 
     }); 
    }); 
}); 
</script> 
</head> 
<body> 

<button>Get JSON data</button> 
<div></div> 

</body> 
</html> 
+0

服務器文件是否在相同的IP? – Sutha

+0

您是否嘗試過更新版本的jQuery?任何控制檯錯誤? – Sparky

+0

這兩個文件都在不同的ips –

回答

0

您可以jquery.xdomainajax.js

Remeber這樣做是爲了明確type GET它。

$("button").click(function() { 
    jQuery.ajax({ 
     url: "http://50.116.19.49/rest/user.json", 
     type: 'GET', 
     success: function(result) { 
      $("div").text(result.responseText); 
     } 
    }); 
});​ 

這是Fiddle

+0

您的代碼可以在小提琴上完美工作,但是當我將其複製到本地機器時,它將停止工作。任何評論 –

+0

你忘記了包含xdomainajax.js –

相關問題