我怎样才能在javascript中的HttpWebRequest的等效方法 [英] How can i get Equivalent method of HttpwebRequest in javascript

查看:70
本文介绍了我怎样才能在javascript中的HttpWebRequest的等效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家都知道的HttpWebRequest加载幕后另一页无客户端重定向到另一个页面。

As we all know HttpwebRequest loads another page behind the scenes without redirecting the client to the other page.

我怎样才能使用Javascript / jQuery的此功能?

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

推荐答案

使用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)
    }
});

这篇关于我怎样才能在javascript中的HttpWebRequest的等效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆