Custom ajax call returns 0 [duplicate]

Modify your registerform() function to include die() after you echo your response. Example:

function registerform(){
    echo $_POST['name'];
    die();
}
add_action('wp_ajax_registerform', 'registerform');
add_action('wp_ajax_nopriv_registerform', 'registerform');