mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
363aeb3416
- Finalized Update For ESX Identity That Gives Access To The Deferrals Update + The two optional UI based updates.
35 lines
1.0 KiB
JavaScript
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()
|
|
}));
|
|
}
|
|
});
|
|
});
|