作为JSON对象的一部分,我通过$ajax
这样过来:
$.ajax({
url: 'untitled.php',
type: 'GET',
success: function(data) {
var obj = jQuery.parseJSON( data );
$.each(obj.entry, function(i, data) {
console.log(data.content);
});
}
});
我在我的控制台中为每个obj.entry
:
<table border=\"0\" width=\"100%\">\n
<tr>\n
<td>\n
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n
<tr valign=\"top\" align=\"left\">\n \n
<td align=\"center\" width=\"166\" valign=\"top\">\n
<a href=\"https://itunes.apple.com/us/podcast/serial/id917918570?mt=2&uo=2\">
<img border=\"0\" alt=\"This American Life - Serial artwork\" src=\"http://is2.mzstatic.com/image/thumb/Podcasts69/v4/90/ef/70/90ef704d-a2d6-ca6f-6972-1b62f8eadb01/mza_7676577196916555630.png/170x170bb-85.jpg\" />
</a>\n
</td>\n
<td width=\"10\">
<img alt=\"\" width=\"10\" height=\"1\" src=\"https://s.mzstatic.com/images/spacer.gif\" />
</td>\n \t
<td width=\"95%\">\n \n \n
<b>
<a href=\"https://itunes.apple.com/us/podcast/serial/id917918570?mt=2&uo=2\">Serial</a>
</b>
<br/>\n \n \n \n \n\n
<a href=\"https://itunes.apple.com/us/artist/wbez/id364380278?mt=2&uo=2\">This American Life</a>\n\n
<font size=\"2\" face=\"Helvetica,Arial,Geneva,Swiss,SunSans-Regular\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t \t
<br/>\n
<b>Genre:</b>
<a href=\"https://itunes.apple.com/us/genre/podcasts-news-politics/id1311?mt=2&uo=2\">News & Politics</a>\n \n\t\t\t\t\t\t \t
<br/>\n
<b>Release Date:</b> February 6, 2016\n \n
</font>\n
</td>\n
</tr>\n
</table>\n
</td>\n
</tr>\n
<tr>\n
<td>\n \n
<font size=\"2\" face=\"Helvetica,Arial,Geneva,Swiss,SunSans-Regular\">
<br/>Serial is a podcast from the creators of This American Life, hosted by Sarah Koenig. Serial unfolds one story - a true story - over the course of a whole season. The show follows the plot and characters wherever they lead, through many surprising twists and turns. Sarah won't know what happens at the end of the story until she gets there, not long before you get there with her. Each week she'll bring you the latest chapter, so it's important to listen in, starting with Episode 1. New episodes are released on Thursday mornings.
</font>
<br/>\n \n \n \n
<font size=\"2\" face=\"Helvetica,Arial,Geneva,Swiss,SunSans-Regular\"> © © Copyright 2016 Serial Podcast</font>\n\t \n
</td>\n
</tr>\n
</table>\n
&#13;
我希望从这里获取img src
网址。有没有办法做到这一点?
答案 0 :(得分:2)
试试这个: 的console.log($(data.content).find(&#39; IMG&#39;)ATTR(&#39; SRC&#39;));