Title: c2c in javascript pop-up script?
Last modified: August 18, 2016

---

# c2c in javascript pop-up script?

 *  [amirs](https://wordpress.org/support/users/amirs/)
 * (@amirs)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/c2c-in-javascript-pop-up-script/)
 * Hi. I’m using the c2c_get_custom plugin, and I’m trying to use it to display 
   all my custom field key/valueu pairs in a pop-up window…using the following brief
   javascript pop-up window function:
 * ‘<script language=”javascript”>
    function openPage() { OpenWindow=window.open(“”,“
   newwin”, “height=250, width=250,toolbar=no,scrollbars=”+scroll+”,menubar=no”);
   OpenWindow.document.write(“<h1><?php echo c2c_get_custom(‘myKey’); ?></h1>”) 
   OpenWindow.document.close() self.name=”main” } </script> ‘
 * Unfortunately it doesn’t work…the php echo doesn’t return anything, and I just
   end up with a pop-up window that is empty: <h1></h1>
 * Is there a reason the c2c functions don’t work? Is it because it’s in a <script
   > or a function?
 * Any help will be appreciated.
 * Thanks,
    Amir

Viewing 1 replies (of 1 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 6 months ago](https://wordpress.org/support/topic/c2c-in-javascript-pop-up-script/#post-287175)
 * Mixing PHP with Javascript is a tricky business. Instead of trying to pump it
   through to the popup (which is next to impossible), assign the c2c_get_custom()
   output to a Javascript variable, and display that:
 * `<script language="javascript">
    function openPage() { var get_custom = "<?php
   echo c2c_get_custom('myKey'); ?>"; OpenWindow=window.open("", "newwin", "height
   =250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no"); OpenWindow.document.
   write("<h1>" + get_custom + "</h1>"); OpenWindow.document.close(); self.name="
   main"; } </script>

Viewing 1 replies (of 1 total)

The topic ‘c2c in javascript pop-up script?’ is closed to new replies.

## Tags

 * [c2c](https://wordpress.org/support/topic-tag/c2c/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * Last activity: [20 years, 6 months ago](https://wordpress.org/support/topic/c2c-in-javascript-pop-up-script/#post-287175)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
