Home > front end >  A page has two forms, use JS (Django query) automatically generated form, two always generates a lis
A page has two forms, use JS (Django query) automatically generated form, two always generates a lis

Time:09-22

The function queryReservation () {
Let inputVal=$(" # inputReservation "). Val ();
$. Ajax ({
Url:/yard/query_like_reservation,
Type: "GET",
Data: {
InputVal: inputVal
},
DataType: "json",
Success: the function (res) {

$(" # all_reservation "). The empty ();
Let tbodyObj=document. GetElementsByTagName (' tbody ');
for (let i=0; i let newTr=document. The createElement method (' tr);
Let newTd=` & lt; td> The ${res [I] [' ApptNum]} & lt;/td>
The ${res [I] [' CtnNo]} & lt;/td>
The ${res [I] [' Vessel ']} & lt;/td>
The ${res [I] [' Voyage ']} & lt;/td>
The ${res [I] [' CtnTyp]} & lt;/td>
The ${res [I] [' CtnSize]} & lt;/td>
The ${res [I] [' CtnOwner]} & lt;/td>
The ${res [I] [' Status']} & lt;/td>
The ${res [I] [' OpDate]} & lt;/td>
The ${res [I] [' FaultDate]} & lt;/td>
The ${res [I] [' HurrySig]} & lt;/td>
The ${res [I] [' Position ']} & lt;/td>
Delete & lt;/a> -->
Edit & lt;/a> -->
`;
NewTr. InnerHTML=newTd;
TbodyObj [0]. The appendChild (newTr);
}

}
})
}

CodePudding user response:

Whether because of getElementsByTagName total return to the first, try to use getElementByID complains,,,,

CodePudding user response:

Had changed to the getElementsByName
  • Related