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
- Pass request headers in a jQuery AJAX GET call
- jQuery Ajax error handling, show custom exception messages
- How to send multiple data fields via Ajax?
- My javascript is returning this error: $.ajax is not a function
- Jquery Ajax Posting JSON to webservice
- Ajax TypeError: $.POST is not a function
- TypeError: $.ajax(…) is not a function?
- XML Parsing Error: not well-formed in FireFox but good in Chrome
- Ajax Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
- 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?
- How to get a cross-origin resource sharing (CORS) post request working
- jQuery Form Validation before Ajax submit
- jQuery – Illegal invocation
- jQuery ajax error function
- How to manage ajax calls and JSON in wordpress
- Return only Count from a wp_query request?
- ajax stopped working when not logged in?
- Using jQuery to delete data stored in wp_options
- WordPress AJAX File Upload – FrontEnd
- How to add a ” waiting” icon for an ajax in WP frontend?
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- What is the simplest ajax upload plugin or script to be used with wordpress?
- AJAX nonce with check_ajax_referer()
- Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?
- WordPress Ajax URL for function in functions.php
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- wp_mail script with jQuery post
- Ajax call does not activate callback function
- AJAX call returns 0
- AJAX function returning -1
- call shortcode in javascript
- Multipart/formatted MySQL query problem
- WP set auth cookie using Ajax is not saved to browser
- jQuery and AJAX Not working with Select Form Element
- How to pass both action and formdata in wordpress ajax?
- jquery & ajax getting data to php in wordpress
- AJAX returns response 0
- jQuery AJAX form validation
- AJAX Implementation
- Passing a varible from jQuery to PHP
- Proper way to load a single post via Ajax?
- Basic WordPress AJAX Call
- Trying to get single posts to load on the front page via ajax
- ajax call in wordpress front end
- Jquery ajax to custom php file: returning blank data
- AJAX post into pop-up div
- Bind to WPSetAsThumbnail
- Ajax not firing properly using Firefox, but works in Chrome
- jQuery Ajax() doesn’t work when the page is accessed as a WordPress template page
- Foreach-generated custom tax queries, each with an ajax “Load more” button
- Appending anchor tag to next post
- How to Use JSON With AJAX?
- wp_localize_script, variable is not defined in jquery
- How to load whole WordPress pages dynamically with AJAX/jQuery like this following website?
- Using wp_ajax and wp_ajax_nopriv hooks
- WP REST return value to error function from Request
- Can’t use get_results() in ajax query
- Creating custom AJAX requests
- How to pass jQuery ajax URL value
- Registration e-mail check with AJAX
- Cannot access elements of json object
- Basic ajax call in WordPress
- Updating User Profile with AJAX not working
- how to get the comment ID in the front end when the REPLY button is clicked?
- Auto Load New Posts
- Admin wp_ajax hook returning 0
- wp_ajax() question.. not using wp_enqueue_script?
- wp_ajax unauthenticated and authenticated
- Showing Author Information and Latest Post by author in lightbox when clicked on the name of the author
- WordPress Ajax not function as I expect… what’s wrong?
- Accept AJAX call with serialized form data
- wp_verify_nonce not working
- Tags in WordPress 3.2
- php ajax problem – weird 301 responses!
- Ajax $wpdb not returning table data
- WordPress customizer refresh screen after save
- Is there a restriction in WP on the use of jQuery load function?
- Loading posts via AJAX in a hidden div with updated URL?
- How to get a value from PHP in Jquery through Ajax
- Not sure why wp_ajax isn’t working?
- Load created php file data via ajax
- Why is variable not working on custom sql query using wpdb?
- Any possible way to make $wpdb->get_results() return anything else than array?
- Jquery not showing in homepage
- Checking for new message using AJAX and PHP. Server overload?
- Updating a checkbox value to database for specific row in table
- Ajax not posting form data to query in PHP function
- jQuery Ajax returning correct Response, but after redirect to 404 Error
- WordPress Ajax problem with undefined url
- How to get those data using with ajax json?