Reputation: 43
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?
$(document).ready(function () {
debugger;
var ip = '<%= Request.UserHostAddress%>';
var location = window.location.href;
var Browser = BrowserDetect.browser;
var Version = BrowserDetect.version;
var Os = BrowserDetect.OS;
var SendItems = 'Ip=' + ip + '&location=' + location + '&Browser=' + Browser + '&Version=' + Version + '&Os=' + Os;
var HttpWebReq = ?
I want to pass these values as a query string to the other page :S
Upvotes: 0
Views: 2953
Reputation: 29005
A cross domain example by using yql,
var url = 'xyz.com'; // website you want to scrape
var 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)
}
});
Upvotes: 1
Reputation: 100547
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
Upvotes: 0