我在网页上有一个带有此代码的功能:
enter code here function LoadGrid() {
var gridder = $('#as_gridder');
var UrlToPass = "action=load";
//was var UrlToPass = 'action=load';
gridder.html('loading..');
$.ajax({
url : 'cartajax.php',
contentType: 'application/x-www-form-urlencoded;charset=ISO-8859-7',
type : 'POST',
data : UrlToPass,
success: function(responseText) {
gridder.html(responseText);
}
});
}
在ajax.php中我有这段代码:
enter code here $action = $_POST['action']; switch($action) { case "load":
我看不到任何东西,只能加载...... 问题只出在ie8
答案 0 :(得分:0)
IE8
在使用jQuery's html()
可能这是一个已知的错误。您可以参考this
方法是
try {
//new browsers
$('#domElement').html(responseText);
} catch (e) {
//IE8
$('#domElement').innerHTML = responseText;
}
修改-1 强>
function LoadGrid() {
// var gridder = $('#as_gridder');
var UrlToPass = "action=load";
//was var UrlToPass = 'action=load';
gridder.html('loading..');
$.ajax({
url : 'cartajax.php',
contentType: 'application/x-www-form-urlencoded;charset=ISO-8859-7',
type : 'POST',
data : UrlToPass,
success: function(responseText) {
try{
$('#as_gridder').html(responseText);
} catch (e) {
//IE8
$('#as_gridder').innerHTML = responseText;
}
}
});
}