繁体   English   中英

使用colorbox加载外部URL然后截断

[英]Load external url with colorbox then truncate

我已经有一段时间了,所以我希望我能在这里找到解决方案。

我希望打开外部URL到colorbox弹出框中的iframe。 这一切都很好。 我只想运行一个post post加载的函数来摆脱我不需要的任何内容(例如标题和正文标记)。 这是我到目前为止:

$('a[href*="/return-policy"]').colorbox({
        href: "/return-policy?language=" + lang,
        width: "800px",
        height: "600px",
        scrolling: false,
        iframe: true
    });

这返回:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>title</title>
</head>

<body>
<div>load of crap I dont need</div>
    <div class="content-content colorbox-content" id="content-content">
    THE STUFF I NEED
    </div>
<div>load of crap I dont need</div>    
</body>
</html>

这就是我所需要的(在colorbox-content包括div colorbox-content ):

<div class="content-content colorbox-content" id="content-content">
   THE STUFF I NEED
</div>

非常感谢任何帮助。

谢谢C.

尝试这个:

$('a[href*="/return-policy"]').colorbox({
        href: "/return-policy?language=" + lang + " #content-content",
        width: "800px",
        height: "600px",
        scrolling: false
    });
var your_result=     $("div").append($("#content-content")).html()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM