@Gordon
Sorry for the delayed response and Thank you for the suggestion, i tried as above suggested, when i tried to tap on puck it did not redirect me the the webpage. Please see the below code i tried on puck.
NRF.on('NFCon', function() {
var currentTime = new Date();
NRF.nfcURL('http://192.168.1.154/studentsystem/details.php?time=' + currentTime.toISOString().substr(0, 16));
});
Below is the Javascript code to extract the date and time from URL on my php webpage
<script>
function getUrlParameter(name) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
window.onload = function() {
var timeParam = getUrlParameter('time');
if (timeParam !== '') {
var loginTime = new Date(timeParam);
var logintimeElement = document.getElementById('logintime');
logintimeElement.textContent = loginTime.toLocaleString(); // Update the text content of the logintime element with the extracted time and date
}
};
</script>
Dont know what i am doing wrong, please guide thank you.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon
Sorry for the delayed response and Thank you for the suggestion, i tried as above suggested, when i tried to tap on puck it did not redirect me the the webpage. Please see the below code i tried on puck.
Below is the Javascript code to extract the date and time from URL on my php webpage
Dont know what i am doing wrong, please guide thank you.