Skip to content

Instantly share code, notes, and snippets.

@gsdevme
Created February 5, 2012 03:12
Show Gist options
  • Save gsdevme/1742308 to your computer and use it in GitHub Desktop.
Save gsdevme/1742308 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