Home  >  Article  >  Web Front-end  >  The $.get() request returns an html page and obtains the element _html/css_WEB-ITnose with a specific id of the page.

The $.get() request returns an html page and obtains the element _html/css_WEB-ITnose with a specific id of the page.

WBOY
WBOYOriginal
2016-06-24 11:47:222253browse

Method 1:

因为data只是一个字符串,并不是一个DOM元素,所以不能用是JQUERY的选择器进行选择的。可以使用字符串正则进行处理。

Method 2:

用js如果不想用正则的话,可以变通实现,创建一个iframe,把<body>里面的所以字符通过document.write()进去,等iframe里面的页面加载完成时,再调用window.frames["iframe的id"].document.getElementById('id').innerHTML


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn