0
我目前有以下JavaScript/jQuery脚本,它使用AJAX获取外部html页面并在其所有文本节点上运行一个函数。不能修改返回的AJAX变量
$.get('webpage.html', function (html) {
$(html).find('*').each(function() {
$(this).contents().filter(function() { return this.nodeType === 3 }).each(function() {
this.nodeValue = foo(this.nodeValue);
console.log(this.nodeValue);
});
console.log(html);
});
然而,虽然记录的新文本节点值发生了变化,是正确的,当我试图在最后记录的HTML我只得到什么我开始用,用没有修改的原外部网页它。
我在做什么错?
DLiKS