zat*_*ata 11
那取决于您如何请求数据.如果你有$ .ajax等,那么你可以在成功处理程序中进行必要的修改.我假设因为你不太了解jQuery,你使用$ .load()来加载数据,在这种情况下最简单的替换它
$.get('/somecode.php', function(data) {
data = $(data);
// Find and remove all anchor tags for example
data.find('a').remove();
$('#target-id').append(data);
});
Run Code Online (Sandbox Code Playgroud)
或者,如果您不想创建jQuery对象,您可以轻松地执行类似的操作
$.get('/somecode.php', function(data) {
// Replace all strings "foo" with "bar" for example
data = data.replace('foo', 'bar');
// Manually append it to DOM or do whatever you want with it
$('#target-id').append(data);
});
Run Code Online (Sandbox Code Playgroud)