H
H
habrdima2018-05-21 19:18:27
CMS
habrdima, 2018-05-21 19:18:27

Why action: "my_action" for wordpress ajax?

There is code for ajax wordpress

var data = {
      action: 'my_action',
            name: 'hello'
    };

    jQuery.post( myajax.url, data, function(response) {
            var d = document.querySelector('.fm'); 
            d.innerHTML = response;
    });


without action: "my_action" doesn't work, why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
leni_m, 2018-05-21
@habrdima

see handlermyajax.url

A
Alex, 2018-05-23
@pilolin

Read the article on ajax in wp . my_action is the event the hook is hooked on to run the request handling function on the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question