i'm developing wp plugin in which when user enter id to get post against that id. that is working fine on admin side. i followed example to get data by ajax call
http://dobsondev.com/2015/06/12/wordpress-ajax-example/
but now i'm trying to do on customer side where anyone can enter id and get result. I removed function which was using to create page on admin side. rest of that i have 4 function named
hello_word() , ajax_script(), ajax_handler()
i tried to use following add_Action to register but it was not working
add_action( 'admin_footer', 'ajax_script' );
then i tried following to register ajax_script
add_action( 'wp_ajax_my_action', 'ajax_script' );
add_action( 'wp_ajax_nopriv_my_action', 'ajax_script' );
hello_word() function contain code for text field and button i call hello_word() function from template file, it displays correctly, but ajax is not working when i click button , the issue i found is that ajax_script() is not loaded and in debugging mode in source there is nothing when i click button.
so how to load ajax function correctly. while i'm calling hello_word() from template file.
