I solved my problem with lots and lots of testing things out.
Apparently my FormData Object was not correct.
Doing these changes to my code worked:
$('#xml').on('submit', function(e) {
e.preventDefault();
var form_data = new FormData(this);
form_data.append('action', 'calculate_xml');
$.ajax({
url : ajaxurl,
type: "POST",
data : form_data,
processData: false,
cache: false,
contentType: false,
success:function(response){
$('#response').html(response);
},
error: function(response){
$('#response').text('error');
}
});
});
Related Posts:
- AJAX image upload with a upload progress bar using media_handle_upload
- What’s the preferred method of writing AJAX-enabled plugins?
- How to load wp_editor via AJAX
- “Add Media” button in custom plugin
- Allow all file types for upload
- Remote upload file to server B
- Help with 4.6. Attachment response object in JSON API plugin
- How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
- What plugin can I use to create a list / slideshow of featured images?
- Plugin or advice on how to parse XML in real-time?
- Upload specific images to specific folder
- Help making my pagination plugin better
- Any plugin out there that uses WP’s internal image uploader?
- admin-ajax returning 400 error when request is made with Fetch API
- How to upload image with simple form?
- Way to force media uploader use custom image size
- How to make WordPress use protocol indepentent upload files?
- How can I pass a variable to wp_ajax action?
- Loading shortcode with ajax
- How to pass JavaScript variable to PHP in wordpress widget?
- Add image to post from external URL
- how does wp.media javascript library work?
- WordPress import does not fetch images, but just links them
- How to create an edit media button for slideshow plugin?
- How to add a sub menu with AJAX?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Please select a file error
- jQuery AJAX call not executing in Plugin
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- Execute a function using ajax
- Problem running Ajax in WordPress
- Ajax Load More and Masonry: is it possible to load admin-ajax.php in the front end?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- ‘Lazy loading’ list of posts with pagination
- Errors while using ajax from external wordpress page
- I can’t access wordpress functions from an ajax php call
- Built in admin ajax hooks?
- Use Media Uploader in Plugin
- How to include admin-ajax when loading external javascript
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- delete_user_meta Delete one value out of array
- How can I add a custom meta value on file upload?
- How to use wp-ajax in wp-cron
- Calling shortcode in wp_localize_script strips result
- Why is my ajax call refreshing the page?
- What’s the point of using WordPress’s built in admin-ajax.php?
- Admin-ajax.php is dying “0” without processing function
- How to upload thousands of images?
- Extending WP’s upload/insert media functionality
- Deleting images through upload folder, but not deleting from media library
- how to use ajax to display from database and load more in wordpress plugin
- Generated Images sizes do not match Media Settings Image Size
- How can I use a video header that’s over 8MB?
- How to remove an Ajax action
- Saving/Writing/Adding file to upload folder
- How to create popup same as wordpress popup feature
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Get Plugin Information from Multiple Sites Externally
- Ajax with jQuery UI dialog not working
- Shortcode in AJAX popup
- How to add pagination to wpbakery grid?
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- How to import 55k images (uploaded via FTP) into WordPress Media libary? [closed]
- How can I reuse the WordPress search form for a custom plugin / widget?
- Is it possible to personalize the Media Library?
- Changing image URLs in media library
- jQuery Plugin to use WordPress functions in AJAX request
- ajax front-end increment views on click
- Bulk Image Uploader to create new post from each image [closed]
- Upload file inside plugins options page
- $wpdb working with ajax but showing ajax error instead of success
- Why none of the plugins that have ajax doesn’t work in my website?
- Ajax gives 400 error
- Adding Attachment Display Settings in custom media frame
- Check if email address exists front end with AJAX in a plugin
- Why plugin ajax response is -1?
- Why do plugins that cause ‘unexpected output’ create AJAX problems?
- WordPress Ajax Callback
- Find unused images?
- plugin ajax to external php file always return null
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- WooCommerce get_price returning wrong price when used via ajax
- Shortcode button dosent work for all posts. Work for first post only
- Plugin upload to install
- AJAX button run function
- When to use action hooks and plugins
- Simple ajax call not working in wordpress plugin
- Widget with same content across several websites
- The problem with WordPress Importer
- Form isn’t inserting data into database with ajax plugin
- Media upload not working on theme option in WordPress 3.8.1
- Why does my functions.php cause white-screen and media-library issues?
- Image upload and other options in the same plugin settings form?
- How organize uploaded media in WP?
- What’s the best way to implement AJAX in WordPress?
- How to Create a Custom Panel and Fields in Post Page [Plugin]
- How to put JQuery/Ajax inside shortcode?
- AJAX search posts and pages
- How to find the origin of a file upload from within wp_handle_upload?