我的操作中有以下代码
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 输出。有什么想法吗?
最佳答案
不要使用 .remove(),因为这样您将删除该元素,并且在下一步中找不到任何元素。而且,没有名为 .innerHTML() 的方法...您应该使用 .html()
希望有帮助
关于jquery - 在 Grails 中通过 AJAX 渲染模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8351727/