-->
STUDENT'
}));
window.location.href = "/admission/auth/login";
} else {
$('#alertData').show().html('Something went wrong, please try again
');
}
}).fail(function (jqxhr, textStatus, errorThrown) {
// Log the raw response for debugging
console.log("Raw Error Response:", jqxhr.responseText);
// Parse the JSON response
let data = JSON.parse(jqxhr.responseText);
// Log the parsed error data for debugging
console.log("Error data:", data);
// Check if the 'errors' field exists in the response
if (data && data['errors']) {
// Check if specific error fields exist ('email' and 'contact')
if (data['errors']['email'] && data['errors']['email'][0]) {
// Display email error message
$('#alertData').show().html('' + data['errors']['email'][0] + '
');
} else if (data['errors']['contact'] && data['errors']['contact'][0]) {
// Display contact error message
$('#alertData').show().html('' + data['errors']['contact'][0] + '
');
} else {
// Display a generic error message if specific errors are not found
$('#alertData').show().html('Something went wrong, please try again!
');
}
} else {
// Display a generic error message if 'errors' field is not found
$('#alertData').show().html('Something went wrong, please try again!
');
}
});
}
});
}
});