wp_ajax_ works fine but wp_ajax_nopriv_ returns HTML and not calling function

Found the solution, reason why it was returning HTML is because it was doing a 302 redirect to the home page.

Turns out that I had a function in my theme that redirects none logged in users away from the wp-admin pages which is where admin-ajax.php is.

<?php
    // IF SUSBSCIBER GOES TO ADMIN /wp-admin THEY ARE REDIRCTED TO THE HOME PAGE START : this code works as of 2018-01-29 (no plugins)

      /**
      * Redirect back to homepage and not allow access to
      * WP admin for Subscribers.
      */

     function themeblvd_redirect_admin(){
          if ( ! current_user_can('delete_published_posts')) { // changed from edit_posts so that it works for contibuters to
               wp_redirect( site_url() );
               exit;         
          }
     }
     add_action( 'admin_init', 'themeblvd_redirect_admin' );
?>

I have it there for testing, so if have testing with a holding page I allow clients to login using a subscriber account, once they are logged in they are redirected to the home page instead of seeing the there user page. I found the solution for this once I released it was a 302 redirect, I found this thread on the subject: https://stackoverflow.com/questions/9408334/wordpress-admin-ajax-results-in-error-302-redirect