How Can I Get Equivalent Method Of Httpwebrequest In Javascript
As we all know HttpwebRequest loads another page behind the scenes without redirecting the client to the other page. How can I get this functionality using Javascript/Jquery? $(do
Solution 1:
A cross domain example by using yql,
var url = 'xyz.com'; // website you want to scrapevar yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + url + '"') + '&format=json&callback=?';
$.getJSON(yql,function(data){
if (data.results[0]){
console.log(data = data.results[0].replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')); // The scraped data (the whole webpage)
}
});
Solution 2:
As Corbin commented - you are looking for AJAX tutorial.
Since you've tagged with JQuery starting from JQuery.ajax is a good idea.
Also check out other related questions like - How to get page content using Javascript or JQuery
Post a Comment for "How Can I Get Equivalent Method Of Httpwebrequest In Javascript"