jQuery将HTML加载到< div> [英] jQuery load HTML into <div>

查看:73
本文介绍了jQuery将HTML加载到< div>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如:

 < div class =MyContent> 

< html>
< head>
< title> Hello World Page< / title>
< / head>
< body>
Hello World
< / body>
< / html>

< / div>

我可以将div中的所有HTML替换为URL中的内容吗?

解决方案

您正在寻找 .load()


从服务器加载数据并将返回的HTML放入匹配的元素。



Is there a way with jQuery to load Html contents from a url?

For example:

<div class="MyContent">

<html>
<head>
<title>Hello World Page</title>
</head>
<body>
Hello World
</body>
</html>

</div>

Can I replace all of the HTML above in the div with the content from a URL?

解决方案

You're looking for .load()

Load data from the server and place the returned HTML into the matched element.

这篇关于jQuery将HTML加载到&lt; div&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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