Your AJAX callback method should be outputting something followed by a die() statement.
function wp_insert() {
..your code
echo $whatever_your_results_are;
//
die();
}
I would also recommend against prefixing your custom methods with wp_
. That should be reserved for WordPress and will cause confusion to other developers – and probably you 6 months down the road 🙂
Hope this helps
Related Posts:
- Ajax Query returns zero
- WordPress ajax function parameter value not being passed
- Search query with Ajax
- wordpress mysql / wpdb ajax load more for terms help
- How to pull data from a table using wpdb?
- Is not using admin-ajax to ajax submissions okay?
- Dynamically populate Cascading Dropdown from MySQL using JQuery/AJAX [closed]
- How to combine jQuery in-place editor with $wpdb->update
- JSON parsing error syntax error unexpected end of input
- How to send multiple data fields via Ajax?
- Jquery Ajax Posting JSON to webservice
- How to fix the ‘Missing required request header. Must specify one of: origin,x-requested-with’ Ajax Error
- What’s the point of the X-Requested-With header?
- WordPress AJAX File Upload – FrontEnd
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- AJAX nonce with check_ajax_referer()
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- wp_mail script with jQuery post
- WP set auth cookie using Ajax is not saved to browser
- jquery & ajax getting data to php in wordpress
- AJAX returns response 0
- Passing a varible from jQuery to PHP
- ajax call in wordpress front end
- Appending anchor tag to next post
- How to Use JSON With AJAX?
- wp_localize_script, variable is not defined in jquery
- Using wp_ajax and wp_ajax_nopriv hooks
- WP REST return value to error function from Request
- Registration e-mail check with AJAX
- wp_ajax() question.. not using wp_enqueue_script?
- WordPress Ajax not function as I expect… what’s wrong?
- Accept AJAX call with serialized form data
- Ajax $wpdb not returning table data
- Loading posts via AJAX in a hidden div with updated URL?
- How to get a value from PHP in Jquery through Ajax
- Jquery not showing in homepage
- Checking for new message using AJAX and PHP. Server overload?
- Ajax not posting form data to query in PHP function
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- How to get those data using with ajax json?
- Front-end Ajax File Upload
- Correct way to write jQuery functions in WordPress
- gravity forms jQuery.load into modal [closed]
- jQuery ajax call throws an HTTP 302
- Disable stored tags queries in admin page when posting a new post
- How to handle 400 status in Ajax [duplicate]
- WooCommerce Ajax Cart Update Stopped Working
- WordPress AJAX Load More function duplicating a post
- AJAX Loaded Glossary like Search results with links to other entries from custom table
- Advanced Ajax Page Loader (AAPL) blocks resources
- Trouble with WordPress Ajax Login System – 302
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- how update data through ajax and jquery
- wpdb COALESCE won’t work
- Why use admin-ajax.php when loading pages through AJAX?
- WP Rest Api / Ajax POST not working when not logged in
- Custom WordPress Table wpdb
- Creating a new div onclick wordpress+ajax
- Ajax Validation for reCaptcha
- Sorting WP Auctions by date/price?
- Properly embed javascript into WP (using function.php) – doesn’t work?
- jQuery tabs plugin with callback to fetch data
- A $_POST should occur when submit form but is not?
- Shortcode to pull posts
- fill form fields with ajax response
- Adding custom cart price with Ajax in wordpress
- Custom AJAX form not working async
- Null/undefined return in WordPress AJAX request
- AJAX Success Function using JS substr() fails in WP 4.1 vs 4.0
- Manipulate retrieved ajax data in php
- Using Jquery submit with ajax request
- WordPress Mysql query and Duplicate
- Why is ajax working on one server and not the next?
- How to use wp_update_post with ajax on frontend
- Converting a working AJAX form to work with WordPress
- Connect Agile Carousel to WordPress AJAX
- WordPress Front-End Theme Editor
- Change Query Arguments (filter) with jQuery/Ajax or PHP?
- Ajax page load in wordpress the right way?
- jQuery forms & updating info
- Remove escape characters from JSON string pulled from a database
- wordpress ajax upload media not working
- Reload selected post in multiple post query with ajax
- jQuery.post() calling function with parameter
- $_POST empty in using new php file added to theme
- Passing variable data from external jQuery file to options.php
- How to specify url for ajax call in wordpress plugin
- Possibility of creating a folder in the wordpress root install and installing a file there, all via plugin?
- Displaying contents of a tab
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Load more button
- Ajax autocomplete based on usercode
- Variable not being returned from Ajax Javascript (though javascript receives it)
- Page keeps refreshing with Ajax form
- Convert WordPress SACK code to new admin-ajax
- Get selected value with PHP and jQuery
- Ajax request with jQuery without WP_ajax
- Can’t access data from database using AJAX
- Contact Form 7 – Submit Form not working After Ajax Request [closed]