Title: Externalize JS
Last modified: May 7, 2017

---

# Externalize JS

 *  [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * (@gmariani405)
 * [9 years ago](https://wordpress.org/support/topic/externalize-js/)
 * Is there a reason the AJAX version is written into the page instead of being 
   an external JS file? By being written, it doesn’t play well with caching plugins
   like W3 Total Cache. If it was an external file, it would obey defer statements
   and load in order iwth jQuery. I request that you externalize this javascript
   into a registered script within wordpress so it can be handled better. Thanks
 * <script type=”text/javascript”>/*<![CDATA[*/var cpdTime=new Date().getTime()/
   1000;jQuery(document).ready(function()
    {jQuery.get(‘/wp-admin/?page=cpd_ajax&
   f=count&cpage=2&time=’+cpdTime,function(text) {var cpd_funcs=text.split(‘|’);
   for(var i=0;i<cpd_funcs.length;i++) {var cpd_daten=cpd_funcs[i].split(‘===’);
   var cpd_field=document.getElementById(‘cpd_number_’+cpd_daten[0].toLowerCase());
   if(cpd_field!=null){cpd_field.innerHTML=cpd_daten[1];}}});});/*]]>*/</script>

The topic ‘Externalize JS’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/count-per-day_d2a1c1.svg)
 * [Count per Day](https://wordpress.org/plugins/count-per-day/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/count-per-day/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/count-per-day/)
 * [Active Topics](https://wordpress.org/support/plugin/count-per-day/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/count-per-day/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/count-per-day/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [gmariani405](https://wordpress.org/support/users/gmariani405/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/externalize-js/)
 * Status: not resolved