it give me “404 not found” after execute search.
<a href="index.html" class="navbar-brand">Students Info</a>
When a user clicks on the Students Info link, you attempt to go to a file named index.html, but Codepen does not know anything about this file, so you get a 404 error.
actually I have separate files for html. but I got the same result.
then it is not something that can be seen from the codePen you posted. If you want help here you need to show something else, like your github repository or a project set up in codepen (not just a pen)
Not 100% sure what you are asking here.
But you are not using the
studentId in the
getStudent function. You have to filter the students array so you are left with just the single student object.
const students = response.data.students; console.log(students); const student = students.filter((student) => student.id === studentId); console.log(student);
Thanks, but I made filter before make an Id then I made Id into the seessionStorage then passed it to another html page.
When clicking the Student Details button you call
studentSelected function you set the id in localStorage, then navigate to students.html using
In students.html you call the
getStudent function and in that function you are not getting the single student by using the id you saved. You just have the full array of objects and are trying to get to the properties of the single student before filtering that single student object out so you can use its properties.
Here is a codesandbox with the changes I mentioned
Iasjorg Thanks so much for your clarification . The point you mentioned is important. Now it’s working well like you said.