【问题标题】:How could I get html source from enter URL?如何从输入 URL 获取 html 源代码?
【发布时间】:2015-11-06 06:07:18
【问题描述】:

这是索引:link

code .js:

// JavaScript Document
$(function() {
    $('#button').click(function() {
        //  $('#iframe').outerHTML();
        //  console.log($('#iframe').outerHTML());
    });
});

【问题讨论】:

  • 这里没有问题。
  • 您想使用 JavaScript 从您自己的页面 iframe 或远程获取 html 内容?

标签: javascript php jquery html


【解决方案1】:

虽然这个问题很老,但这个答案可能对其他人有用。可以简单地使用ajax请求来获取链接的html内容。

$.ajax({ url: 'your-url', success: function(data) { alert(data); } });

【讨论】:

    猜你喜欢
    • 2011-07-14
    • 2014-11-25
    • 1970-01-01
    • 2012-04-22
    • 2019-06-12
    • 1970-01-01
    • 2010-11-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多