我在动作中有以下代码
render ( template: 'partial_list_template', model: [messageList: entries, totalFound: count, activeUILink: "all_mgs_link", termFreqs: null])
我在gsp页面中有以下代码
$j("#filterUpdate").click(function(event){
var form = $j('#flags');
new Ajax.Request('/tabulae/webForm/filter',
{
onSuccess:function(resp){
console.log(resp.responseText);
console.log($j('#filterResults'))
$j('#filterResults').remove()
$j('#filterResults').innerHTML(resp.responseText)
},
onError: function(resp) {
alert("Error:" + resp.toJSON());
return;
},
asynchronous:true,
evalScripts:true,
method:'GET',
parameters:form.serialize()
});
});
即使我在控制台日志中看到html输出。我没有在我添加此内容的元素中看到html输出。有什么想法吗?
答案 0 :(得分:4)
不要使用。 remove(),因为那时您将删除该元素,并且在下一步中没有要找到的元素。但是,也没有名为。 innerHTML()的方法......你应该使用。 html()
希望有所帮助
答案 1 :(得分:2)
尝试使用empty
$j('#filterResults').empty();
$j('#filterResults').innerHTML(resp.responseText);