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
- How to make Contact Form 7 work when injected via AJAX in WordPress?
- Removing custom physical folders with rmdir
- Catch Form value at AJAX Form submit
- How to delete original image file after upload and resize
- Ajax is not defined
- JS global variable doesn’t update
- 400 Bad Request getting on AJAX Call
- ajax load more instead of pagination
- 404 error custom post type rest api
- An error has occurred during the upload process in wordpress version 5.3.2
- admin-ajax.php 403 errors – no caching, permissions are fine
- Ajax not sending the data correctly- Multidimensional array
- jQuery AJAX url wit variable
- React to AJAX adding to the page
- gform_after_submission does not work on ajax enabled form
- Attend event form with ajax
- Updating Jquery object with newly created elements after AJAX call
- Is there a way to add ajax hooks without editing the functions.php file?
- Implement AJAX to fetch pages or posts content in a WordPress custom theme
- How to update cart total after AJAX success
- Not getting ajax success response on insert/update row to database
- How to add Ajax to this Pagination i made?
- 400 Bad request while submitting form using AJAX
- Adding user using admin ajax by a user with custom role
- Hook after all metadata are set is triggering several time
- How can I run two AJAX requests simultaneously in WordPress?
- get a bad request 400 on my ajax-admin.php file