jQuery在一个元素中加载多个html文件 [英] jQuery load multiple html files in one element

查看:95
本文介绍了jQuery在一个元素中加载多个html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何加载多个html文件并将它们放入指定的html元素中?

How do i load multiple html files and putting them into a specified html element?

我试过没有更改:

$('#asd').load('file.html,pippo.html');


推荐答案

您可以获取多个项目并将其添加到元素。

you could get multiple items and add them to the element.

jQuery.ajaxSetup({ async: false }); //if order matters
$.get("file.htm", '', function (data) { $("#result").append(data); });
$.get("pippo.htm", '', function (data) { $("#result").append(data); });
jQuery.ajaxSetup({ async: true });  //if order matters

这篇关于jQuery在一个元素中加载多个html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆