Skip to content

Instantly share code, notes, and snippets.

@gsdevme
Created February 5, 2012 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsdevme/1742307 to your computer and use it in GitHub Desktop.
Save gsdevme/1742307 to your computer and use it in GitHub Desktop.
(function(window,document,undefined){
var url,l;
el=document.getElementsByClassName('grabHolidayImages');
if(el!=undefined){
l=el.length;
for(i=0;i<l;++i){
url = el[i].getAttribute('title');
foo = new ajax(url, (function(html){
var regex=new RegExp('<img src="(.*?)" />', 'g');
console.log(regex.exec(html)[1]);
});
}
}
})(window,document);
function ajax(url, callback){
var xmlHttp = new XMLHttpRequest() || new ActiveXObject('Microsoft.XMLHTTP');
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState==4 && xmlHttp.status==200){
return callback(xmlHttp.responseText);
}
};
xmlHttp.open('get', url, true);
xmlHttp.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment