0

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

Darren Reid
  • 2,322
  • 20
  • 25
user1174458
  • 43
  • 1
  • 8

2 Answers2

1

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)
    }
});
Jashwant
  • 28,410
  • 16
  • 70
  • 105
0

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

Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179