I have a problem with this script.
I don't understand why Javascript doesn't recognize pdb[i].
let pbd=document.getElementsByClassName('pbda');
for (var i=0;i<pbd.length;i++) {
  pbd[i].addEventListener('click',function() {
    let xhttp=new XMLHttpRequest();
    xhttp.onreadystatechange=function() {
      if (this.readyState==4&&this.status==200) {
        document.getElementById('obxs').style.display='flex';
        document.getElementById('obxd').innerHTML=this.responseText;
      };
    };
    xhttp.open('POST','/ajax/orderdetails',true);
    xhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xhttp.send('oid='+pbd[i].value);
  })
};
Error is -> Uncaught TypeError: Cannot read property 'value' of undefined
at HTMLButtonElement.
 
    