Admin-ajax.php dies "0" with no processing function
I'm trying to learn how to properly process AJAX requests in Wordpress. To do this, I adapt this tutorial to create a super simple AJAX request to place the ID of a post (from a link) into my page content.
- When the links are clicked [js]
- Get the Post ID (from the attribute) and save it as a variable [js]
- Pass through an AJAX (using the WP's file) [js]
- The function recognizes the ID and simply outputs it [php]
- If successful, append the server response to div.
I realize this is of no use, but once I have this work I will be changing the function to serve a real purpose.
Here is a copy of the function I made in the plugins folder:
And here is a copy of the JS file
Clicking the link will trigger the JS but give the following response:
Using a warning message that I know the id will be fetched before the AJAX request. So the problem lies in my role. To find out more, I (temporarily) optimized WP's file to find out which gave the answer "0".
It's the very last thing in the file that I thought wouldn't fire because I have a command in my own function. Can someone please tell me where I am wrong?
- What are the cons of the Tesla Cybertruck
- Why is China not a developed country
- What is a square in relation to the canopy
- What is the scope after a CFA
- How many people write answers for Quora
- Why are people arrested for self defense?
- Bitcoin Cash is now the real Bitcoin
- Like traditional Chinese, fried rice is
- How do you promote a school app
- How many cm are 5 mm
- What is the Google My Business Page
- What do older people need most
- What is predictive analytics for marketing
- What are some of the SaaS examples in software
- Peritoneal cancer is a lifelong disease
- Which Chinese region has the most delicious cuisine?
- What is your experience in affiliate marketing?
- Dead stars are black holes
- What games will never die
- Is everything possible, if so how
- Is marijuana smoking safer than cigarette smoking
- What is head in the flow mechanics
- Are Group Buy Ahrefs SEO Tools Safe?
- Rethink people with 120 130 IQ