[英]How to pass dynamic PHP variable as parameter in window.open method
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. 我正在尝试使用javascript中的window.open方法创建一个弹出窗口,它在没有任何动态变量传递的情况下也可以正常工作,但是我没有得到如何在函数内部传递php变量,使其在另一个窗口中起作用。
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. 我想将此
$myUrl
变量作为url参数传递,它将反映在弹出窗口中。
Thanks 谢谢
<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>
<?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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.