I am trying to crawl a web page using javascript by making use of api on the click of download button. But I don't receive any responseText in this and same api works using curl.
download.addEventListener('click',function(){
document.getElementById('check').innerHTML = url;
var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + url + '"') + '&format=json&callback=?';
document.getElementById('check').innerHTML = yql;
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
document.getElementById('check').innerHTML= request.readyState;
if(request.readyState ===XMLHttpRequest.DONE) {
document.getElementById('check').innerHTML= request.responseText;
}
};
request.open("GET", yql, true);
request.send;
},false);
request.send()
? – The Witness