Files
esx_core/html/js/script.js
T
ArkSeyonet 363aeb3416 Update ESX Identity
- Finalized Update For ESX Identity That Gives Access To The Deferrals Update + The two optional UI based updates.
2020-05-15 19:27:31 -05:00

35 lines
1.0 KiB
JavaScript

$(function() {
window.addEventListener('message', function(event) {
if (event.data.type == "enableui") {
document.body.style.display = event.data.enable ? "block" : "none";
}
});
$("#register").submit(function(event) {
event.preventDefault(); // Prevent form from submitting
// Verify date
var date = $("#dateofbirth").val();
var dateCheck = new Date($("#dateofbirth").val());
if (dateCheck == "Invalid Date") {
date == "invalid";
}
else {
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(dateCheck)
const mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(dateCheck)
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(dateCheck)
var formattedDate = `${mo}/${da}/${ye}`;
$.post('http://esx_identity/register', JSON.stringify({
firstname: $("#firstname").val(),
lastname: $("#lastname").val(),
dateofbirth: formattedDate,
sex: $("input[type='radio'][name='sex']:checked").val(),
height: $("#height").val()
}));
}
});
});