From my experience if an ajax call in wordpress returns 0, it means that ajax can’t find the related php function, so check three times that the function you point to in ‘add_action’, function name and the action of your form do match.
I usually include an action attribute in the ajaxSubmit options as well, maybe it solves your problem. Just add action : ‘my_ajax_upload’ to the options array.
Since you have
If you get -1 instead of 0, it means that the nonce check (check_ajax_referer($nonce)) failed.
Related Posts:
- admin-ajax.php returns 0. How do I debug it and fix it?
- jQuery’s .on() method combined with the submit event
- Load minimum WordPress environment
- Upload post thumbnail from the front end
- WordPress AJAX File Upload – FrontEnd
- Nonces and Cache
- How to HTML5 FormData Ajax
- admin-ajax.php doesn’t work when using POST data and Axios
- Contact Form 7 Custom Post Action
- Custom Form with Ajax
- ajax – why multiple calls to wp_create_nonce() return same value?
- How to link WordPress heartbeat to ajax form
- Ajax form submission from admin panel
- Confused on AJAX submit form through page template
- insert post & Upload post thumbnail from the front end using ajax
- how to use reCaptcha v3 in wordpress custom login form?
- AJAX action not triggering PHP function
- How to allow to user non logged in WP system upload in media library?
- AJAX image upload with a upload progress bar using media_handle_upload
- Prevent page reload after ajax form submission
- Using wp_handle_upload and media_handle_sideload with ajax
- submitting form via admin-ajax.php returns 0
- Admin Ajax and HTML5 Formdata
- jQuery Ajax passing empty parameters to my function?
- Using ajax with wordpress
- Using AJAX with Forms
- How to know what page is calling admin-ajax.php?
- How to set post_id to 0 when you upload image via Add media button. (async-upload.php)
- wp_handle_upload returns empty error array
- Ajax post returning full html page as response
- Pass additional parameter with async upload
- Sending variable from ajax on form submit
- contact form ajax empty response error message
- Can’t trigger an AJAX function with a submit button in the dashboard
- Dynamically add more fields/remove last field in a form
- Ajaxify Form That Submits To Same Page To Display Post Data [closed]
- Using admin-ajax prevents regular php form submission
- Specify ABSPATH in jQuery url
- ajax form is returning the dreaded “[HTTP/1.1 400 Bad Request” and a zero
- How to disable drag-and-drop upload function in Media Library?
- Output multi-steps form results in same page
- Using get_theme_mod in php ajax form doesn’t work
- How to create a form button that executes a function?
- How to stop being directed to admin.php after sending request to admin-ajax.php
- Run javascript upon successfully set featured image
- Distinguish between 2 instances of admin-ajax.php
- How to detect if the ajax_query_attachments_args was triggered to set the featured image?
- How to display contact form 7 form in vanilla js without jquery in frontend
- Why is the file not uploading to the server?
- Should wordpress nonce be placed in html form or in javascript file
- Add Server Side validation in Ajax mail form
- How to send automatic response after form submission without plugin
- Opening Modal popup on Ajax form submission
- Frontend AJAX Media Upload returning 404
- How to require files in a custom endpoint
- Registration form AJAX check for existing username (simple version)
- Issue developing an AJAX form with WordPress
- Ajax show custom post data form & script
- Display post thumbnail after clicking on post id with AJAX
- (Frontend AJAX) get post data WITH image thumbnail?
- Using AJAX on Contact-form the WordPress way
- Retrieve Header Background Image with AJAX
- Cannot add multiple single images at once
- Error while submitting form using AJAX and php
- How to send custom variable in Media Uploader ajax request?
- Ajax contact form returnig 0
- wp_enqueue_media problem
- Ajax Form data is not posted back to the get_results()
- Using AJAX for dynamic settings pages
- Ajax Form seems to post, but does not return
- Bad Request when adding new post via ajax form
- jQuery form plugin, submit in the wordpress way
- Displaying PHP Errors from admin-ajax.php
- wp_set_auth_cookie() doesn’t work in Ajax call
- Modify featured image path to Amazon S3
- Using Nonces for AJAX that only retrieves data
- fetching via fetch/ajax gutenberg block data from third party
- How to load new text widgets and polls into the sidebar without reloading the page?
- Ajax Multi Response Problem
- Custom AJAX Endpoint not returning any result
- Contact form 7 Hide response messages after 5 seconds
- how should i get json encoded data from wordpress ajax action page
- Ajax Plugin Not Echoing Response
- ajax problem – function on server is not called
- Sharing variables in both actions wp_footer and wp_ajax
- Display full WordPress post under search form using AJAX
- jQuery.post returns 0
- Ajax sometimes work and sometimes just don’t work
- admin-ajax error 400
- wordpress admin ajax trash_comment
- Javascript output now showing in custom widget
- Create a post with REST API and adding a category
- how to correctly use json_encode with ajax
- How to block search engines indexing certain AJAX actions
- wp_ajax_action, wp_ajax_nopriv_action not working
- Ajax call activate after submit in edit-tags.php page
- using ajax to query sql
- WordPress Custom wp mail template return full template
- Front-end ajax problem all users and guests getting a 302 redirect when accessing wp-admin/admin-ajax.php
- Use Ajax to get an Options Settings Value