javascript - Parse img from HTML from JSON Object -


this question has answer here:

as part of json object i'm getting via $ajax so:

$.ajax({ url: 'untitled.php', type: 'get',  success: function(data) {  var obj = jquery.parsejson( data ); $.each(obj.entry, function(i, data) {                 console.log(data.content);             });   } }); 

i (for example) in console each 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 podcast creators of american life, hosted sarah koenig. serial unfolds 1 story - true story - on course of whole season. show follows plot , characters wherever lead, through many surprising twists , turns. sarah won&#39;t know happens @ end of story until gets there, not long before there her. each week she&#39;ll bring latest chapter, it&#39;s important listen in, starting episode 1. new episodes released on thursday mornings.              </font>              <br/>\n            \n            \n            \n                              <font size=\"2\" face=\"helvetica,arial,geneva,swiss,sunsans-regular\"> &#169; © copyright 2016 serial podcast</font>\n\t        \n                  </td>\n          </tr>\n  </table>\n

i'm looking img src url here. there way this?

try this: console.log($(data.content).find('img').attr('src'));


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -