redirect does not work in ajax function
I'm using ajax to post the form data. In the end I want to redirect to homepage. I'm trying following code, it does not work. It returns error 302. How can I redirect in the following function? Thanks.
add_action('wp_ajax_nopriv_custom_register', 'custom_register');
add_action('wp_ajax_custom_register', 'custom_register');
function custom_register(){
//process
wp_redirect( home_url() );
exit;
}
Topic wp-redirect ajax redirect theme-development Wordpress
Category Web