-1

I have a site that creates a profile page on the fly. I want to add a skype button to the page for each of the profiles - each profile having a different ID.

I have found this code:

  <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
  <div id="SkypeButton_Call_skypeid_1">
  <script type="text/javascript">
    Skype.ui({
      "name": "call",
      "element": "SkypeButton_Call_skypeid_1",
      "participants": ["skypeid"],
      "imageSize": 32
    });
  </script>

This is just pasted into a php file at the moment.

I need to change the skypeid on the fly - I can do it for the html bits easy enough since I have a php variable for skypeid.

How do I pass this variable into the javascript?

Kalle
  • 2,282
  • 1
  • 24
  • 30
maxelcat
  • 1,333
  • 2
  • 18
  • 31
  • possible duplicate of [How to pass variables and data from PHP to JavaScript?](http://stackoverflow.com/questions/23740548/how-to-pass-variables-and-data-from-php-to-javascript) – Kalle Jul 08 '15 at 09:14

1 Answers1

2
<script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
<div id="SkypeButton_Call_skypeid_1">
  <script type="text/javascript">
    Skype.ui({
      "name": "call",
      "element": "SkypeButton_Call_skypeid_1",
      "participants": ["<?php echo $skypeid ?>"],
      "imageSize": 32
    });
</script>

should be what you need. If you cant access that script directly define a global javascript variable and pass that to the script

Marvin Fischer
  • 2,552
  • 3
  • 23
  • 34
  • thanks - I'll try that - the 'possible duplicate' above mentioned this - and talked about pros and cons. But I want something quick for now so i think this is ok – maxelcat Jul 08 '15 at 09:46