Title: Internal JavaScript Not Working in WP Post
Last modified: August 22, 2016

---

# Internal JavaScript Not Working in WP Post

 *  [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/)
 * Hello,
 * I have a script that automatically opens a modal popup 5 seconds after the page
   loads working on other non WP pages of my website.
 * However, when I insert the script into a WP post, it doesn’t work. Please help!
   See the WP post here: [http://www.jwsuretybonds.com/blog/getting-your-new-business-bonded-print-bond-modal](http://www.jwsuretybonds.com/blog/getting-your-new-business-bonded-print-bond-modal)

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/page/2/?output_format=md)

 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776738)
 * Just some additional info…my Chrome console detects an error of “Uncaught ReferenceError:
   jQuery is not defined” on line 70. I tried adding the jQuery library to the header.
   php file, but that didn’t fix the issue.
 * Any help is greatly appreciated!
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776886)
 * I completely stumped…does anyone have some insight?
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776888)
 * See:
 * [http://codex.wordpress.org/Using_Javascript](http://codex.wordpress.org/Using_Javascript)
 * BTW, you should get WP up to date – old versions are a security risk!
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776889)
 * This might be useful:
 * [https://wordpress.org/plugins/css-javascript-toolbox/](https://wordpress.org/plugins/css-javascript-toolbox/)
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776890)
 * Hey WPyogi,
 * Thanks for the response. I tried implementing the wp_enqueue_script() within 
   the functions.php file, but this did not fix the error.
 * I also tried installing the plugin you suggested, but this also didn’t fix the
   issue.
 * Any other ideas as to why the “Uncaught ReferenceError: jQuery is not defined”
   on line 70 is occurring?
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776892)
 * You could check for JS errors?
 * [http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors](http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors)
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776893)
 * The exact error that I believe is causing the modal to not work is “Uncaught 
   ReferenceError: jQuery is not defined” on line 70.
 * The issue is occurring in IE10, Firefox 33.0, and Chrome.
 * I added the SCRIPT_DEBUG to the wp-config.php file, but it did not fix the error
   either.
 * I’m really stumped.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776917)
 * Did you remove that code? Or did you link to the wrong page? Where is the page
   with this javascript error?
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776929)
 * I did remove the code…I’m going to attempt doing this via plugin. Thanks!
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776936)
 * It turns out there’s not many reliable Bootstrap modal plugins for WP. Would 
   you mind helping me troubleshoot the problem if I add the code back to the post?
 * Let me know! Thanks.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776937)
 * Sure but sometimes we can be unavailable to check the code, which can mean leaving
   the code up there for quite some time
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776938)
 * Let me know when a good time is for you, as I don’t want to leave it up for days.
   Thanks.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776939)
 * Can you do right now
 *  Thread Starter [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * (@eweisbrot)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776940)
 * Please see here: [http://www.jwsuretybonds.com/blog/getting-your-new-business-bonded-print-bond-modal](http://www.jwsuretybonds.com/blog/getting-your-new-business-bonded-print-bond-modal)
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/#post-5776941)
 * Is this your script:
 *     ```
       <script type="text/javascript">//<![CDATA[
       					jQuery(document).ready(function(){
       						jQuery.get('http://www.jwsuretybonds.com/blog/wp-admin/admin-ajax.php', {
       							action: 'update_views_ajax',
       							token: '0160a1448f',
       							id: 7125						}, function(response){
       							if ( console && console.log )
       								console.log(response);
       						});
       					});
       				//]]></script>
       ```
   

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/page/2/?output_format=md)

The topic ‘Internal JavaScript Not Working in WP Post’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 26 replies
 * 3 participants
 * Last reply from: [eweisbrot](https://wordpress.org/support/users/eweisbrot/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/internal-javascript-not-working-in-wp-post/page/2/#post-5776965)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
