Pass a php variable in a script

NewPassionnate

I have the function below, how can I add my php variables id and fn instead of escape(window.location.href) ?

$mRow = $this->row;
$wRow = $mRow->getInfo(); 
$id= $mRow->id;
$fn = $mRow->first_name;

<script language="javascript">
  function fbshareCurrentPage()
    {window.open("https://www.facebook.com/sharer/sharer.php?u="+escape(window.location.href)+"&t="+document.title, '', 
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
     return false; }
</script>
NewPassionnate
<script language="javascript">
 var id= <?php echo json_encode($id); ?>;
 var fn = <?php echo json_encode($fn); ?>;

 function fbshareCurrentPage()
{window.open("https://www.facebook.com/sharer/sharer.php?u="+id+"/"+fn+"&t="+document.title, '', 
'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
 return false; }

</script>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related