Hi i'm desiging a plugin and m new here i want to use ajax java live search box script in my wordpress plugin, so please answer me...

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
    <script type="text/javascript" src="html-table-search.js"></script>
    <script type="text/javascript">
                searchText:'Search Table',
                searchPlaceHolder:'Input Value'
  • how can i use this script in my wordpres plugin?? Thnks – Ashish Jaiswal Oct 28 '16 at 10:12
  • The question is not clear. Please update the question with more clarity.. – Unnikrishnan R Oct 28 '16 at 15:54

Since you didn't ask clearly I understood that you want to know how to include script to your plugin. If so, do this:

wp_enqueue_script( 'your_plugin_name', plugin_dir_url( __FILE__ ) . 'js/your-script.js', array( 'jquery' ),'1.0.0', true );
  • Thnx....But i want to use the given script in wordpress so tell me please how can i use this scipt in wordpress?how i put i? i'm using like - - – Ashish Jaiswal Oct 28 '16 at 10:20
  • wp_register_script('html-table-search','code.jquery.com/jquery-2.1.3.min.js'); wp_enqueue_script( 'html-table-search'); is this correct way???? – Ashish Jaiswal Oct 28 '16 at 10:21
  • Second parameter of wp_register_script() is path to the file you want to include. If you want to include script which uses jQuery do this: wp_register_script('jQuery','code.jquery.com/jque‌​ry-2.1.3.min.js'); wp_enqueue_script( 'jQuery'); wp_register_script('myScript','/path/to/my/script.js', array('jQuery')); wp_enqueue_script( 'myScript'); NOTE that '/path/to/my/script.js' is relative to current folder (that's why I used plugin_dir_url( __FILE__ )). Also make sure that path to jquery-2.1.3.min.js is correct – Sebastian Kaczmarek Oct 28 '16 at 10:29
  • ok... Now this is am using ---- - - - wp_register_script('jQuery','code.jquery.com/jque‌​ry-2.1.3.‌​min.js'); wp_enqueue_script( 'jQuery'); wp_register_script('myScript','html-table-search.js', array('jQuery')); wp_enqueue_script( 'myScript'); – Ashish Jaiswal Oct 28 '16 at 10:36
  • its.. 'http//code.jquery.com/jque‌​ry-2.1.3.‌​‌​min.js' but still not working – Ashish Jaiswal Oct 28 '16 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.