Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iframe中的jquery clone()内容_Jquery_Clone - Fatal编程技术网

iframe中的jquery clone()内容

iframe中的jquery clone()内容,jquery,clone,Jquery,Clone,最初,我想将一些内容(div class=“StaffBlock”)从远程页面的iframe加载到div class=“Contact Agent Append”中。但是append()方法被证明不适用于iframe。正常情况下,它可以工作,但由于我使用的是模板,模板不是一个静止的页面,我认为;这就是为什么append()无法将内容放入当前页面。然后我注意到clone()正在工作,但它会意外地重复内容的20个克隆。请帮我克隆一次。非常感谢 这是包含iframe的原始编码: <div cla

最初,我想将一些内容(div class=“StaffBlock”)从远程页面的iframe加载到div class=“Contact Agent Append”中。但是append()方法被证明不适用于iframe。正常情况下,它可以工作,但由于我使用的是模板,模板不是一个静止的页面,我认为;这就是为什么append()无法将内容放入当前页面。然后我注意到clone()正在工作,但它会意外地重复内容的20个克隆。请帮我克隆一次。非常感谢

这是包含iframe的原始编码:

<div class="Contact-Agent-{tag_Publish As Agent}">

    <div class="Contact-Agent-Small-Logo-listing" title="this property is published by agent">
    </div>
    <iframe scrolling="no" height="60px" frameborder="0" width="150px" src="{tag_listing agent staff url}" marginwidth="0px" marginheight="0px" style="overflow:hidden; margin:0; padding:0; display: none;"></iframe>
    <script type='text/javascript'>//<![CDATA[
    $(window).load(function(){
    $('iframe').contents().find('.StaffBlock').clone().appendTo($('.Contact-Agent-Append'))
    });//]]>
    </script> 
    <div class="Contact-Agent-Append">content should go here
    </div>

</div>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/StyleSheets/listing-contact.css" />
</head>
<body>
<div class="listing-contact">
<div class="StaffBlock">
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="col-a">{tag_name}</td>
    <td class="col-b" rowspan="4">{tag_Staff Photo}</td>
  </tr>
  <tr>
    <td>{tag_job title}</td>
  </tr>
  <tr>
    <td>{tag_mobile}</td>
    </tr>
  <tr>
    <td><a href="mailto:{tag_email}">email me</a></td>
  </tr>
</table>
</div>
</div>

</body>
</html>

//
内容应该放在这里
这是存储在包含StaffBlock的远程url中的内容:

<div class="Contact-Agent-{tag_Publish As Agent}">

    <div class="Contact-Agent-Small-Logo-listing" title="this property is published by agent">
    </div>
    <iframe scrolling="no" height="60px" frameborder="0" width="150px" src="{tag_listing agent staff url}" marginwidth="0px" marginheight="0px" style="overflow:hidden; margin:0; padding:0; display: none;"></iframe>
    <script type='text/javascript'>//<![CDATA[
    $(window).load(function(){
    $('iframe').contents().find('.StaffBlock').clone().appendTo($('.Contact-Agent-Append'))
    });//]]>
    </script> 
    <div class="Contact-Agent-Append">content should go here
    </div>

</div>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/StyleSheets/listing-contact.css" />
</head>
<body>
<div class="listing-contact">
<div class="StaffBlock">
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="col-a">{tag_name}</td>
    <td class="col-b" rowspan="4">{tag_Staff Photo}</td>
  </tr>
  <tr>
    <td>{tag_job title}</td>
  </tr>
  <tr>
    <td>{tag_mobile}</td>
    </tr>
  <tr>
    <td><a href="mailto:{tag_email}">email me</a></td>
  </tr>
</table>
</div>
</div>

</body>
</html>

{tag_name}
{tag_员工照片}
{tag_职务}
{tag_mobile}

您是否有多个带有
联系人代理Append
类的div

不应使用不可见的iframe,而应使用AJAX:

$(".Contact-Agent-Append").load("{tag_listing agent staff url} .StaffBlock:first");
.load(url[,数据][,完成(responseText,textStatus,XMLHttpRequest)])

描述:从服务器加载数据,并将返回的HTML放入匹配的元素中


您是否有多个带有
联系人代理Append
类的div

不应使用不可见的iframe,而应使用AJAX:

$(".Contact-Agent-Append").load("{tag_listing agent staff url} .StaffBlock:first");
.load(url[,数据][,完成(responseText,textStatus,XMLHttpRequest)])

描述:从服务器加载数据,并将返回的HTML放入匹配的元素中