ajax call too functions.php
var ajaxurl = 'https://example.com/wp-admin/admin-ajax.php';
$.ajax({
url: ajaxurl,
type: 'post',
data: { action: 'register_user' ,"username": "arshia"},
success: function(response) { console.log(response); }
});
Glorious Gnat