Using JQuery to get the HTML from another website: Possible? Legal?

后端 未结 5 1875
猫巷女王i
猫巷女王i 2021-02-04 14:40

I am trying to get HTML code from a webpage that is not in the same domain. The html text is parsed & summarises a recipe(recipe name, main ingredients, no. of steps) found

5条回答
  •  温柔的废话
    2021-02-04 15:36

    The same origin applies. try this code and you'll face security error

    $.get("other web page site", {}, function(content){
       $("#receipe").html(content)
    }, "html")
    

    btw, you'll more likely violate copyright law, so be wary ;-)

提交回复
热议问题