'success', 'message' => 'Blog deleted successfully']); } else { // Return an error response as JSON echo json_encode(['status' => 'error', 'message' => 'Failed to delete blog']); } $link->close(); } else { // Return an error response if the request method is not DELETE echo json_encode(['status' => 'error', 'message' => 'Invalid request method']); }