Get content of the page given by an URL thru Javascript

核能气质少年 提交于 2019-12-13 03:54:59

问题


Does anybody here solved a similar problem?

I have a link that contains nothing but another link.

For example, given a URL lets say it is www.abc123proxy.info. And then that URL contains another URL on its page (yeah, just text) lets say the URL for this one is www.masked-url.com?token=231940812093810. I need go to the second URL but I only have the first URL.

This is what I want to happen:

$(document).ready(function() {window.location = 'www.abc123proxy.info';});
// But I wanted to go to the link inside the page of that URL.

Is this problem can be solve using javascript? I'm open for other better solution if you have.

Thanks!


回答1:


$.ajax({
        url:'first_url',
        type:'get',
        success:function(data){
          var _newUrl=$(data).find('a:first');
        }
})


来源:https://stackoverflow.com/questions/4075464/get-content-of-the-page-given-by-an-url-thru-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!