Title: Inline Ajax Call
Last modified: March 9, 2017

---

# Inline Ajax Call

 *  [Davide Prevosto](https://wordpress.org/support/users/daweb/)
 * (@daweb)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/inline-ajax-call/)
 * Hi there,
 * I am minifiying jQuery script too, and all it’s working fine.
 * I need to add this snippet:
 *     ```
       if(!wp_script_is('jquery', 'done')) {
                   wp_enqueue_script('jquery');
               }
       ```
   
 * `wp_add_inline_script( 'jquery-migrate', "jQuery(document).ready(function(){alert('
   debug')});" );`
 * Is there a way to add this few lines AFTER the aggregated autoptimize js file?
 * Thank you

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

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/inline-ajax-call/#post-8893239)
 * no, as Autoptimize injects the JS later (after the HTML has been rendered but
   before it’s send to the browser) and it is injected before the closing body-tag.
   you can change the “injection-point” by using the AO API, e.g.
 *     ```
       add_filter('autoptimize_filter_js_replacetag','my_ao_override_js_replacetag',10,1);
       function my_ao_override_js_replacetag($replacetag) {
               return array("<injectjs />","replace");
               }
       ```
   
 * so if you add a fake “injectjs”-tag (in your theme, before the `wp_footer()`)
   and you make sure the result of the above PHP-snippet is added in the footer 
   and excluded from autoptimize, then it could work.
 * hope this helps,
    frank
 *  Thread Starter [Davide Prevosto](https://wordpress.org/support/users/daweb/)
 * (@daweb)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/inline-ajax-call/#post-8893484)
 * Thank you [@futtta](https://wordpress.org/support/users/futtta/), I am really
   sorry but it’s not so clear for me. May I ask your further help, please?
    -  This reply was modified 9 years, 5 months ago by [Davide Prevosto](https://wordpress.org/support/users/daweb/).
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/inline-ajax-call/#post-8895124)
 * pretty much in the dark here as well [@daweb](https://wordpress.org/support/users/daweb/),
   as your snippet is PHP and I don’t know where it ends up in the HTML. hence the
   somewhat generic reply. I’ll need more info if you need more help 🙂
 * frank

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

The topic ‘Inline Ajax Call’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/inline-ajax-call/#post-8895124)
 * Status: not resolved