I've done it successfully with XHR, If someone else will need to do this, here is an example code :
Code:
var xhr = new XMLHttpRequest();
var formObjData = {
timezoneoffset: 2,
dst: 2,
'options[adminemail]': 1,
'options[showemail]': 1,
do: 'addmember',
password: $("input[name='password']")[0].value,
passwordconfirm: $("input[name='passwordconfirm']")[0].value,
username: $("input[name='username']")[0].value,
agree: $("#agree")[0].checked,
email: $("input[name='email']")[0].value,
emailconfirm: $("input[name='email']")[0].value,
securitytoken: 'guest'
};
var strObj = '';
for (var k in formObjData) {
if (formObjData.hasOwnProperty(k)) {
var val = formObjData[k];
strObj = strObj + `${k}=${val}&`;
}
}
strObj = strObj.slice(0, strObj.length - 1);
xhr.open('POST', './register.php?do=addmember', true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
// sucess code
} else {
if (xhr.status !== 200) {
alert('error);
}
}
}
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(strObj);