Javascript 如何更改加载在其他html';人体标签

Javascript 如何更改加载在其他html';人体标签,javascript,jquery,html,Javascript,Jquery,Html,我正在另一个页面中加载一个html页面,比如说,home.html在index.html中被调用,但现在我想在index.html中的java脚本或jquery的帮助下更改home.html的一些内容 下面是我到目前为止所做的尝试 index.html <html> <body> </body> </html> <script> $('body').load('home.html'); // below d

我正在另一个页面中加载一个html页面,比如说,
home.html
index.html
中被调用,但现在我想在
index.html
中的java脚本或jquery的帮助下更改
home.html
的一些内容 下面是我到目前为止所做的尝试

index.html

   <html>
    <body> </body>
</html>
<script>
    $('body').load('home.html');
    // below div **session_error** is from home.html page,I wanted to change its text on this page
           $('#session_error').html("This is session out errror");

</script>

$('body').load('home.html');
//下面的div**session\u error**来自home.html页面,我想更改此页面上的文本
$('#session_error').html(“这是session out error”);
调用
.load()
是异步的。因此,在进行更改之前,您需要等待它完成

比如:

$('body').load('home.html', function() {
   $('#session_error').html("This is session out errror");
});
.load()
调用是异步的。因此,在进行更改之前,您需要等待它完成

比如:

$('body').load('home.html', function() {
   $('#session_error').html("This is session out errror");
});

会话错误
还是
会话错误
?似乎有一个输入错误
load
有一个回调<代码>$('body').load('home.html',function(){//do stuff here})
会话错误
还是
会话错误
?似乎有一个输入错误
load
有一个回调<代码>$('body').load('home.html',function(){//do stuff here})