【发布时间】:2014-05-25 17:22:40
【问题描述】:
我已经使用下面的代码编写了 ajax 请求来动态更改 div:
$(document).ready(function(){
$.ajax({
type : 'GET',
url : url,
success : function(data){
$('#some_div').html(data);
}
});
});
它在 Chrome、FF、Safari 和移动设备上运行良好,但在 IE7+ 中不返回任何内容。难道我做错了什么?或者,这是一个烦人的 IE 错误吗?如果是这样,我该如何解决?
编辑 这是我要提取的文件的 HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Store Notes</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<link type="text/css" href="/css/smoothness/jquery-ui-1.8.11.custom.css" rel="stylesheet" media="all" />
<link type="text/css" href="/css/colorbox.css" rel="stylesheet" />
<link type="text/css" href="/css/rep.css" rel="stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/rep/global.js"></script>
<script type="text/javascript" src="/js/jquery.colorbox-min.js"></script>
</head>
<body><table style="width:100%;" cellspacing="12px">
<tr><td><b>Some Guy</b> <span class="small">Apr 28th</span><br />testing123</td></tr><tr><td><b>Some Guy</b> <span class="small">Apr 28th</span><br />testing123</td></tr></table>
</body>
</html>
【问题讨论】:
-
如果添加 alert('foo'); 会怎样在成功函数中?它可以在 IE 中运行吗?
-
您的代码中缺少逗号(在第 4 行末尾)。
-
我看不出你的代码有什么问题。它应该可以在 IE7 中运行...