im working on a piece of code where im getting the html from another server through php with file_get_contents.
Then some of the links needs to get the original domain onto it so that they link to the proper places, for most of my links ive just been able to replace the whole line as they were static but with this one being dynamic i need to replace just a part of it.
Ive done it this way:
<script>$(document).ready(function(){
$(".view").each(function(){
this.href = this.href.replace("/tourney/", "http://binarybeast.com/tourney/");
})
});</script>
I however am getting the problem that when doing this im getting double domains even though no domain was made in the first link like this:
<a class="view" href="http://localhosthttp://binarybeast.com/tourney/load_match/169049">View Details</a>
Original line:
<a class="view" href="/tourney/load_match/169049">View Details</a>