在下面的代码示例中,我想遍历包含来自 request_page.php 文件的 html 代码的 responseText 对象。在 onSuccess 事件中,我想检查 id 为 'ersDiv' 的 < Div > 中是否有任何错误。
new Request.HTML({
url: 'request_page.php',
onSuccess: function(responseText, responseXML) {
// My expected code to handle responseText object
alert(errorMessage);
},
onFailure: function() { }
});
request_page.php 文件是这样的:
<div align='center'><div id='ersDiv'>Page loaded with insufficient data</div></div>