1
<script>
 var1 = "http://ofuran.com";
 var2 = "?ref=Df34hfgT"; var newlink = var1.concat(var2);
</script>

How I use this newlink variable in the following line? please help me by doing.

<?php echo '<script>window.open("http://www.ofuran.com", "_blank"); </script>'; ?>
5
  • 4
    why do you use php when the variable is in javascript? You can simply use <script>window.open(newlink, "_blank"); </script> Commented Sep 14, 2018 at 2:57
  • Maybe he's trying to bypass Cloudflare? Commented Sep 14, 2018 at 3:07
  • @ALMaMun it solved your problem? Commented Sep 14, 2018 at 3:08
  • No @Forbs I just try to redirect with a new reference. Commented Sep 14, 2018 at 3:10
  • Yes @Rinsad Ahmed. Solved. Thanks again. Commented Sep 14, 2018 at 3:10

2 Answers 2

1

use the code:

<script>
    var1 = "http://ofuran.com";
    var2 = "?ref=Df34hfgT";
    var newlink = var1.concat(var2);

</script>


<?php echo '<script>window.open(newlink, "_blank"); </script>'; ?>
Sign up to request clarification or add additional context in comments.

1 Comment

Why do you need PHP to use JS variables? And please highlight the differences, such that the OP can see it clearly and learn from it
1

You can try like this way,

var var1 = "http://ofuran.com";
var var2 = "?ref=Df34hfgT";
var newlink = var1.concat(var2);
window.open(newlink, "_blank");

1 Comment

@ALMaMun glat it works for you :). By the way plz have a look here stackoverflow.com/help/someone-answers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.