jQuery: query a $.get() returned string

后端 未结 2 1942
夕颜
夕颜 2021-01-28 06:35

How can i query a string i get via $.get? for example, i want form google only the body html:

$.get(\"www.google.com\", function(data){
var body = $(\"body\", da         


        
2条回答
  •  一整个雨季
    2021-01-28 06:49

    Nope, jQuery can't directly access the DOM of a page that was loaded via an XmlHttpRequest. In order to do this, you would have to use an HTML parser written in JavaScript, like the one that John Resig wrote. It's still a much harder task than you were probably expecting though.

提交回复
热议问题