这段代码在FireFox上运行正常,但在IE中,当我尝试从AJAX响应返回的响应中转储内容时,它会产生运行时错误。我正在使用mootools来调用Ajax。
//on dom ready...
window.addEvent('domready', function() {
/* ajax alert */ <br/>
$('ajax-alert').addEvent('click', function(event) {
//prevent the page from changing
event.stop();
//make the ajax call
var req = new Request({
method: 'get',
url: $('ajax-alert').get('href'),
data: { 'do' : '1' },
onRequest: function() { alert('Request made. Please wait...'); },
onComplete: function(response) {
alert(response);// Getting response and able to see that in alert
/*line underneath fives runtime error in IE , works fine in FireFox */
document.getElementById('myDiv').innerHTML = response;
//this line gives run time error on IE
}
}).send();
});
答案 0 :(得分:0)
当返回的响应不是有效的X / HTML时,可能会发生这种情况。我建议您使用其中返回的响应验证页面。正如Dimitar Christoff所提到的,请注意包含块元素的内联元素。