Title: How to upload javascript?
Last modified: August 24, 2016

---

# How to upload javascript?

 *  Resolved [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/)
 * **Site:** [Example](http://drivesafe2015.org)
 * **Link:** [Instructions](http://icode4you.net/how-to-create-a-coupon-discount-for-paypal-buttons)
 * I have discount code box which requires javascript to indicate when code is valid.
 * Javascript file is here: wp-admin/js/discount.js
 * Final step in the instruction is to paste this into the “website section”:
 * `<script type="text/javascript" src="http://yourwebsite.com/discount.js"></script
   >`
 * Since the path is /wp-admin/js/discount.js, I change to:
 * `<script type="text/javascript" src="http://yourwebsite.com/wp-admin/js/discount.
   js"></script>`
 * I paste in PayPal page, nothing.
 * I paste in themefunctions.php, **whitescreen**.
 * Therefore I don’t know what to do.
 * Anyone know a solution?
 * Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [Rocco Aliberti](https://wordpress.org/support/users/d4z_c0nf/)
 * (@d4z_c0nf)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6013850)
 * why there’s that file in wp-admin? Did you put it there? If yes … not a great
   choice, but whatever.. 🙂
 * So take a look here:
    [http://volatylthemes.com/footer/](http://volatylthemes.com/footer/)
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6013912)
 * technically it is supposed to be **.com/discount.js** and right now is **.com/
   wp-admin/js/discount.js**
 * i do not understand the process itself of how this script will activate on the
   PayPal form, or how to implement (where to paste script)…
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6013960)
 * **[@d4z_c0nf](https://wordpress.org/support/users/d4z_c0nf/)**
 * I do not have a child theme… these snippets have child theme in them.
 * Also I do not know where to paste the script to activate on PayPal form.
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6013998)
 * ┈┈╱╱▏╱╱▏
    ┈┈▇╱▏▇╱▏ ┈┈▇╱▏▇╱▏ ┈┈▇▇▇▇╱▏ ┈┈▇╱▏▇╱▏ ┈┈▇╱┈▇╱┈ ______________ ┈┈╱╱╱╱╱
   ▏ ┈┈▇▇▇▇╱┈ ┈┈▇╱▏┈┈┈ ┈┈▇▇▇┈┈┈ ┈┈▇╱╱╱╱▏ ┈┈▇▇▇▇╱┈ _____________ ┈╱╱▏┈┈┈ ┈▇╱▏┈┈┈ 
   ┈▇╱▏┈┈┈ ┈▇╱▏┈┈┈ ┈▇╱╱╱╱▏ ┈▇▇▇▇╱┈ _____________ ┈╱╱▏┈┈┈ ┈▇╱▏┈┈┈ ┈▇╱▏┈┈┈ ┈▇╱▏┈┈┈
   ┈▇╱╱╱╱▏ ┈▇▇▇▇╱┈ ┈╱╱╱╱╱▏ ┈▇▇▇▇╱▏ ┈▇╱▏▇╱▏ ┈▇╱▏▇╱▏ ┈▇╱╱▇╱▏ ┈▇▇▇▇╱┈
 * **Here is what I done so far:**
 * I went to this link and copy HTML snippet:
 *     ```
       // Add scripts to wp_footer()
       function child_theme_footer_script() { ?>
           <script type="text/javascript" src="http://drivesafe2015.org/wp-admin/js/discount.js"></script>
       <?php }
       add_action( 'wp_footer', 'footer_script' );
       ```
   
 * Still, when I use promo code box there is no result.
 * For example you can try code **5OFF** and nothing happens (supposed to be javascript
   popup window.
 *  [CrouchingBruin](https://wordpress.org/support/users/crouchingbruin/)
 * (@crouchingbruin)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014030)
 * Where did you add that code snippet? I would remove it and add it to your site
   this way:
    1. Install the [Header and Footer](http://wordpress.org/plugins/header-footer/)
       plugin. This plugin will allow you to add script to the `head` section of your
       site.
    2. After installing and activating the plugin, go to **Setting → Header and Footer**
       and copy & paste the link into the **Code to be added on HEAD section of every
       page** field:
    3.     ```
           <script type="text/javascript" src="http://drivesafe2015.org/wp-admin/js/discount.js"></script>
           ```
       
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014032)
 * **[@d4z_c0nf](https://wordpress.org/support/users/d4z_c0nf/)**
 * Either this does not work or I did something wrong (probably the latter).
 * **[@crouchingbruin](https://wordpress.org/support/users/crouchingbruin/)**
 * I downloaded the plugin and pasted the above code into both head section of every
   page and home page fields and the PayPal discount code box script still is not
   working.
 *  [CrouchingBruin](https://wordpress.org/support/users/crouchingbruin/)
 * (@crouchingbruin)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014033)
 * When I do a `view source` on your site, I see the link, so the code is there 
   and available.
 * You need to make a change to your `discount.js` code, though. These two array
   definitions:
 *     ```
       var coupons = new Array (  // place to put coupon codes
         "5OFF",                 // 1st coupon value - comma seperated
         "50FF",                 // 2nd coupon value - add all you want
       );
       var coupdc  = new Array (  // place to put discounts for coupon vals
         25,
         25,
       );
       ```
   
 * You need to remove the comma after the last value in each array so it looks like
   this:
 *     ```
       var coupons = new Array (  // place to put coupon codes
         "5OFF",                 // 1st coupon value - comma seperated
         "50FF"                  // 2nd coupon value - add all you want
       );
       var coupdc  = new Array (  // place to put discounts for coupon vals
         25,
         25
       );
       ```
   
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014050)
 * **IT WORKS!**
 * The problem was the commas; there were 3 values originally, and we left the commas
   unknowingly.
 * Thank you so much to both for your help 🙂
 *  Thread Starter [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * (@greenrain37)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014051)
 * [resolved]

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘How to upload javascript?’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/customizr/4.4.24/screenshot.png)
 * Customizr
 * [Support Threads](https://wordpress.org/support/theme/customizr/)
 * [Active Topics](https://wordpress.org/support/theme/customizr/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/customizr/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/customizr/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [css](https://wordpress.org/support/topic-tag/css/)
 * [discount](https://wordpress.org/support/topic-tag/discount/)
 * [edit](https://wordpress.org/support/topic-tag/edit/)
 * [form](https://wordpress.org/support/topic-tag/form/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [paypal](https://wordpress.org/support/topic-tag/paypal/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 9 replies
 * 3 participants
 * Last reply from: [GreenRain37](https://wordpress.org/support/users/greenrain37/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/how-to-upload-javascript/#post-6014051)
 * Status: resolved