AJAX handler throws 400 (Bad request) – why?

in your html add

 `<input name="action" type="hidden" value="test_function"/>` 

here “value” is your “action_name”. Your ajax call is incorect. Data should be

url: "your php action script"
data: $(html data).serialize(),

About ajax first try to create ajax on your computer without wordpress. When you understand how ajax work try on WordPress.

Leave a Comment