I've got this php function located in the base /home/index.php
function addEmail() {
$email = htmlentities($_POST['email']);
if (wp_create_user($email, '7777777', $email)) echo 'OK';
die();
}
I've also got this jQuery function located in /home/js/assets.js. The function checks to see if the email is valid and if so, should run the php function above.
$('#submit_btn').click(function () {
var entered = $('#ms_id-2 > input#input_fld').val();
if (isValidEmailAddress(entered) == false) {
alert('Sorry, the email you entered is invalid. Please try again.');
//console.log('No Validation!');
} else {
alert('Thank you. Your email address has been added to the list.');
}
});
So basically, if the email is valid, I need the code to execute that function in index.php. What's the quickest way to do this?