In our webpage, after clicking, it should be reload and I use window.location.reload
to make that happens. But in developer tool, it's saying Uncaught TypeError: Cannot read properties of null (reading 'reload') in javascript
. Is there anyway to fix?
echo"<FONT color=\"#FF0000\" class=\"ft10\" onClick = \"SetName('".$site."','".$scan4data."','".$hwid."','".$un."','".$hwde."','".$hwlocde."');\" ><b>$barc</b></FONT></a><br>\n";
echo "<script type=\"text/javascript\">";
echo " function SetName(site, scan4data, hwid, un, hwde, hwlocde){";
//, scan4data, hwid, un, hwde, hwlocde, txthwlocde;
//echo "{\n";
echo " var locname= hwlocde; ";
echo " var site2= document.getElementById('site1').value; ";
echo " var txthwlocde = site2 + locname;";
echo " window.location.reload('scantheid.php?site='+ site2 + '&scan4data=' + scan4data + '&hwid=' + hwid + '&un=' + un + '&hwde=' + hwde + '&hwlocde=' + hwlocde + '&txthwlocde=' + txthwlocde);";
//echo " alert ('scantheid.php?site='+ site + '&scan4data=' + scan4data + '&hwid=' + hwid + '&un=' + un + '&hwde=' + hwde + '&hwlocde=' + hwlocde + '&txthwlocde=' + txthwlocde);";
//echo " console.log(txthwlocde);";
echo "window.open('', '_self', ''); window.close()";
echo " }";
echo "</script>";