Refresh DIV using WordPress AJAX.
-
Hello, i have website where i am deleting something. And i am also showing total number of records somewhere at the top of the page.
now what i want to do is that when i delete my record. i also want to refresh that div. so i can get exact number of records..
what is happening right now is that when i delete the record using AJAX it is working but it is not refreshing my number of total records. i have to refresh the page that i can see the exact total records..
does anyone know how to do this? i am using wordpress AJAx function..
This is my delete funtion
if( !function_exists( 'delete_post_item' ) ) { add_action( 'wp_ajax_nopriv_delete_post_item', 'delete_post_item' ); add_action( 'wp_ajax_delete_post_item', 'delete_post_item' ); function delete_post_item() { $post_id = $_POST['post_id']; if($post_id != '') { global $wpdb; $delete_query = "delete query "; $wpdb->query($delete_query); } $response = array( 'what'=>'foobar', 'action'=>'update_something', 'id'=>'1', 'data'=>$post_id ); $xmlResponse = new WP_Ajax_Response($response); $xmlResponse->send(); } }//endif;
please can anyone know how to do that?
how can i refresh div1 and div2..
- The topic ‘Refresh DIV using WordPress AJAX.’ is closed to new replies.