一些内容......
现在我需要将一些文件加载到inner- block中,但保存它的旧内容.
$('#inner').load( 'pathToFile.html' );
Run Code Online (Sandbox Code Playgroud)
将取代div的旧内容.
谢谢.
所以,据我所知,我的代码应该是:
old = $('#inner').html();
$('#inner').load( 'pathToFile.html' );
$('#inner').html( old + $('#inner').html() );
Run Code Online (Sandbox Code Playgroud)
?
我建议不要使用像'load'这样的东西和其他ajax助手.它们只是围绕$ .ajax的包裹.在我的头顶,也许你想要:
$.ajax( {
url: 'pathToFile.html',
type: 'get',
success: function( r ) {
$('#inner').append( r );
}
} );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
658 次 |
| 最近记录: |