开发者

How could i parse this HTML using Jquery?

I want to parse HTML using Jquery

I am getting some HTML from server as responseText like this :

<html>
   <title>Title</title>
   <body>
     <p>My JSON data</p>
   </body>
 </html>

Now 开发者_开发技巧i want to parse this using jquery parseJSON function, How could i do this plz help me.

Thanks


parseJSON is for parsing json

if you are getting a valid html from the server then you can apply jquery's simple DOM traversal methods to it and get the desired object, or you can also use

.parseXML

to parse the html if it contains some non standard html tags


If you simply create a jQuery object with the responseText, it will return a representation of the content in the body of your responseText, e.g.

var jqobj = $('<html><head></head><body><p>Meep</p></body></html>');
var text = jqobj.html();   // returns "Meep"

Then you can parse it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜