문제

I want to fetch the images[] array of an external URL. I was able to retrieve the actual source code of the page using $.ajax, but I don't know how to access the images. Thanks.

도움이 되었습니까?

해결책

You could do something like

var images = [];
$(pagecode).find('img').each(function(){
   images.push( this.src );
});

다른 팁

You can create a img tag, set src to the actual url of image, then append to a specific place:

$('<img/>').attr('src', 'http://www.google.com/intl/en_com/images/srpr/logo3w.png').appendTo('body')

You can use .load() method. The .load() method, unlike $.get(), allows you to specify a portion of the remote document to be inserted.

$('#result').load('http://www.mypage.com/myimages.htm img');

That will load every image on the page.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top