问题描述
限时送ChatGPT账号..我已经使用下面的代码编写了 ajax 请求来动态更改 div:
I have written ajax requests to change divs on the fly by using the code below:
$(document).ready(function(){
$.ajax({
type : 'GET',
url : url,
success : function(data){
$('#some_div').html(data);
}
});
});
它在 Chrome、FF、Safari 和移动设备中运行良好,但在 IE7+ 中没有任何返回.难道我做错了什么?或者,这是一个恼人的 IE 错误吗?如果是这样,我该如何解决?
It works great in Chrome, FF, Safari and mobile devices, but it returns nothing in IE7+. Am I doing something wrong? Or, is this an annoying IE bug? If so, how do I work around it?
编辑这是我尝试引入的文件的 HTML:
EDIT Here is the HTML of the file I'm trying to pull in:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/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/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis/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>
推荐答案
您从 AJAX 请求收到的 HTML 是否有效?如果不是,这将导致 IE 失败,而其他一些浏览器则不在乎.
Is the HTML you receive from the AJAX-request valid? If not this will result in IE failing, while some of the other browsers don't care.
这篇关于如何让 jQuery $(&#39;#div&#39;).html() 在 IE7+ 中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论