Riskbreaker
Riskbreaker

Reputation: 25

Get content of the page given by an URL thru Javascript

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!

Upvotes: 0

Views: 1407

Answers (1)

Praveen Prasad
Praveen Prasad

Reputation: 32127

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

Upvotes: 1

Related Questions