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
- WordPress REST API FormData: Form Not Submitted When No Files Attached
- help on wp_editor via ajax load [duplicate]
- Buddypress ajax problem after adding new groups sub nav [closed]
- How to check username availability with ajax at registration
- admin-ajax.php slow, how to speed it up?
- add_image_size() and uploading the exact size leaves 1×1 image in uploads
- Unable to parse JSON response from wp_send_json_success [closed]
- problem with WordPress ajax
- Jetpack Infinite Scroll – Add more than 7 posts each time?
- How to load next and previous posts by Ajax
- Update attachment metadata fails
- Nonce fails on ajax save
- WordPress P2 live problem
- Best way to use ajax front-end?
- use jQuery.load() to include a php file in a div, wp_query() is part of php file
- Get uploaded image and attach it to the new post
- Something strange with ajax
- admin-ajax.php returns 0 even when the post status code is 200 OK
- REST public POST giving 403 forbidden nginx
- Content including hooks inside wp-settings.php are being called twice in WordPress
- JS global variable doesn’t update
- 404 error custom post type rest api
- Jquery wrap permalink in a data-attribute?
- Load .php file into div using ajax
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- AJAX admin Internal 500 error Failed to Upload
- Class property not visible inside ajax callback function?
- Generate and upload screenshot as featured image for user-submitted post