How to jQuery Ajax show new data from successful insert?
Modify your code as follows: add_action(‘wp_ajax_send_projectmessage’, ‘send_projectmessage’); function send_projectmessage() { global $wpdb; $wpdb->insert( //insert stuff to db table)); // Call your function to retrieve your data and send it to browser $messages = load_projectmessages($projectid); wp_send_json_success($messages); } Display data through JS by modifying this ajaxRequest.done(function(data) { console.log(data); }); to this ajaxRequest.done(function(data) { // Put markup for … Read more