Home  >  Article  >  Web Front-end  >  $.get()请求返回一个html页面,获取该页面特定id的元素_html/css_WEB-ITnose

$.get()请求返回一个html页面,获取该页面特定id的元素_html/css_WEB-ITnose

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

方法一:

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

方法二:

用js如果不想用正则的话,可以变通实现,创建一个iframe,把里面的所以字符通过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