Skip to content
Advertisement

Ajax function call to php function

I have a simple php function as below defined in one of my php file

JavaScript

I am calling above “test” function using below ajax function call

JavaScript

I am expecting console output of “Hello” but I getting below undefined response

JavaScript

Advertisement

Answer

I followed the below video, step by step and it worked. Probably it had something to do with nonce AJAX in WordPress using admin-ajax.php

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement