how to enable ajax on submitting of contact form 7?

Not sure about ajax, but you could use a custom DOM event to run some javascript… From the “contact form 7” documentation: The simplest way is utilizing Contact Form 7’s custom DOM event to run JavaScript. The following is an example of script that redirects you to another URL when the wpcf7mailsent event occurs: <script> … Read more

Trigger action via button

Remove this line add_action( ‘wp_ajax_my_action’, ‘updateContent’ ); Add this two Line add_action( ‘wp_ajax_nopriv_updateContent’, ‘updateContent’ ); add_action( ‘wp_ajax_updateContent’, ‘updateContent’ ); hopefully it will solve your issue https://codex.wordpress.org/Plugin_API/Action_Reference/wp_ajax_nopriv_(action)