1

I am trying to create a window pop up using window.open method in javascript, it works fine simply without any dynamic variable passing, but i am not getting how to pass the php variable inside the function to make it functional in another window.

Here is what i have tried so far:

<?php
   if(isset($d->retweeted_status->id_str)){
      $tweetId = $d->retweeted_status->id_str;
   } else{
      $tweetId = $d->id_str;
   }
   $myUrl = "retweetDetails.php?id=".$tweetId;
<?
<a href="javascript:;" onclick="window.open('retweetDetails.php', 'my_new_window','width=625, height=400');" class="btn btn-default twitter_button_retweets"><?php echo $d->retweet_count; ?> Retweets </a>

I want to pass this $myUrl variable as a url parameter which will reflect in popup window.

Thanks

2
  • window.open('<?=$myUrl?>'? Commented Dec 22, 2015 at 7:09
  • Change <? to ?> before <a tag Commented Dec 22, 2015 at 7:12

2 Answers 2

2
<a href="javascript:;" onclick="window.open('<?php echo $myUrl; ?>', 'my_new_window','width=625, height=400');" class="btn btn-default twitter_button_retweets"><?php echo $d->retweet_count; ?> Retweets </a>
Sign up to request clarification or add additional context in comments.

Comments

0
    <?php
   if(isset($d->retweeted_status->id_str)){
      $tweetId = $d->retweeted_status->id_str;
   } else{
      $tweetId = $d->id_str;
   }
   $myUrl = "retweetDetails.php?id=".$tweetId;
<?
<a href="javascript:;" onclick="window.open('<?php echo $myUrl; ?>', 'my_new_window','width=625, height=400');" class="btn btn-default twitter_button_retweets"><?php echo $d->retweet_count; ?> Retweets </a>

Comments

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.