0

I am using wordpress ajax to trigger a submission. I located the submission code in the submenu page, because of it is have conflict with the function in plugin main page. The problem here is, I should placed the ajax handler in the submenu page function while it will not triggered if it is placed there.

It always returning 0 if the handler is located in the submenu page function. I had added nopriv in the handler hook and also localize the javascript.

The Ajax example from Wordpress Codex is also not working if I put it inside the submenu page function of my plugin.

My question:

  • How to make wordpress ajax working while its handler is placed inside submenu page function?

Thanks in advance!

  • 2
    Can you please paste your code here ? It is easy to understand the code than the prose here. – Subharanjan Dec 16 '13 at 9:43
  • The ajax code is very simple and just a test, not far different with the code from this link codex.wordpress.org/AJAX_in_Plugins. My function is too large to be posted here. – Ari Dec 16 '13 at 9:47
  • Have you tried placing the code in your plugin file outside of the submenu page function? – Douglas.Sesar Dec 16 '13 at 14:35
  • I have. That's why I am asking this question How to make wordpress ajax working while its handler is placed inside submenu page function? – Ari Dec 16 '13 at 14:40

Your Answer

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

Browse other questions tagged or ask your own question.