[英]Load first div from another page using jquery or php
I am not ever sure this is possible but I know you guys will know the answer. 我不确定这是否可能,但我知道你们会知道答案。
I wonder if it is possible to load the first div on a page into a different page. 我想知道是否可以将页面上的第一个div加载到其他页面中。
Example: 例:
This code is on "list.php" 此代码在“ list.php”上
<div class="message_details">
Some Content 1
</div>
<div class="message_details">
Some Content 2
</div>
I found this article and it works but it brings in all div's but I want to load only the first div. 我找到了这篇文章并且它起作用了,但是它引入了所有div,但是我只想加载第一个div。
Load content from external page into another page using Ajax/jQuery 使用Ajax / jQuery将外部页面的内容加载到另一个页面
Here is the code I have now that loads all divs 这是我现在加载所有div的代码
$(document).ready(function() {
$(".loader").load('list.php .message_details');
});
How can I load only the first div? 如何仅加载第一个div? Also is there any way to remove an img tag within the selected div?
还有什么方法可以删除所选div中的img标签?
Thanks everyone 感谢大家
simply echo the the div in the second page. 只需在第二页中回显div。 Give each div an id, then echo that.
给每个div一个ID,然后回显它。 (unless i am misunderstanding your goal)
(除非我误解了您的目标)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.