send value by url to another page
Sun Jul 23 2023 08:59:38 GMT+0000 (Coordinated Universal Time)
Saved by
@nelson22
// onclick of link send value in url
$('.dashboardTableLink').on('click', function(e) {
var matId = $(this).attr('id');
window.location.href=contextPath+`/detailPage?matCode=${matId}`;
})
// getting value from url
function GetURLParameter(sParam){
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return decodeURIComponent(sParameterName[1]);
}
}
}
var mat_id = GetURLParameter('matCode');
content_copyCOPY
Comments