Title: Enqueue js file
Last modified: December 4, 2016

---

# Enqueue js file

 *  [webbeloz](https://wordpress.org/support/users/webbeloz/)
 * (@webbeloz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/enqueue-js-file/)
 * Hi Lester,
 *     ```
       static function scripts() {
       		if ( !self::$add_script )
       			return;
   
       		$js_dev = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.dev' : '';
   
       		//wp_enqueue_script( 'wp-useronline', plugins_url( "useronline$js_dev.js", __FILE__ ), array( 'jquery' ), '2.80', true );
       		wp_enqueue_script( 'wp-useronline', "/assets/forums/js/useronline$js_dev.js", array( 'jquery' ), '', true );
       		//get_template_directory_uri()
       		wp_localize_script( 'wp-useronline', 'useronlineL10n', array(
       			'ajax_url' => admin_url( 'admin-ajax.php' ),
       			'timeout' => self::$options->timeout * 1000
       		) );
   
       		scbUtil::do_scripts('wp-useronline');
       	}
       ```
   
 * as you can see I had to move the js file in my template directory to avoid an
   Internal server error 500. Have you already thought of another way, different
   from my example to avoid this error?
    B.Regards tnx

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

 *  Plugin Author [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * (@gamerz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/enqueue-js-file/#post-8513811)
 * Check your PHP error logs to know what is the exact error? I am guessing it might
   be a theme or plugin conflict on your end.
 * You can try a fresh install of WP with just this plugin.
 *  Thread Starter [webbeloz](https://wordpress.org/support/users/webbeloz/)
 * (@webbeloz)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/enqueue-js-file/#post-8514734)
 * Yes, even I thought,
    but the board is debug_true and no error in debugging in
   log files. Apparently everything seems ok. I do other checks…
 * Q.
    you might think to hide the inclusion of js files from the footer?

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

The topic ‘Enqueue js file’ is closed to new replies.

 * ![](https://ps.w.org/wp-useronline/assets/icon.svg?rev=978026)
 * [WP-UserOnline](https://wordpress.org/plugins/wp-useronline/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-useronline/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-useronline/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-useronline/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-useronline/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-useronline/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Lester Chan](https://wordpress.org/support/users/gamerz/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/enqueue-js-file/#post-8513811)
 * Status: not resolved