0
我有以下的HTML + jQuery的:jQuery.get不接收數據
<body>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script>
$(window).load(function() {
$('#test').bind('click', function() {
$.get("http://localhost:3000/promotions.xml", function(data){
alert("Data Loaded: " + data);
});
});
});
</script>
</head>
<input id="test" type="button" value="Testando">
</body>
的問題是,數據參數是空的,即使當我測試上我看到一個xml文件瀏覽器的URL一些數據進入它。我試圖切換到HTML和JSON,它也沒有工作。服務器報告,一切正常:
Started GET "/promotions.xml" for 127.0.0.1 at Thu Feb 10 16:02:33 -0200 2011
Processing by PromotionsController#index as XML
←[1m←[35mPromotion Load (1.0ms)←[0m SELECT "promotions".* FROM "promotions"
Completed 200 OK in 41ms (Views: 31.0ms | ActiveRecord: 1.0ms)
所以我想這是在javascript/jQuery,我失蹤了。我使用的是jquery 1.4.4。怎麼了?