In the code below, we are registering the user via Ajax request and receiving a JSON reply from the script. The code also checks and validates the sent email address against the user information already in the database. You can place the code in your theme’s functions file and send the form via POST to admin-ajax.