The Jquery implementation clicks on the left title, and a pop-up window appears on the right to display the details corresponding to the left title.

data is from ajax

my initial idea is that the data obtained by the for loop ajax corresponds to the index of the child element in the parent element of the element by clicking on the left heading with this I, so that the data displayed is consistent with the left and right sides.

but I have also made a search function that will lead to the left title of Filter that does not match the input keyword, so that the index, obtained by clicking on the left title does not correspond to the I of the for loop on the right.

if you want to do both of these two functions, how to ensure that the data on the left and right sides are consistent? thank you

Mar.16,2021

then you can't use this I correspondence here, ah, you can use a common field such as id to judge, and then display ah.


I think the data in your title list is too large. You only need to follow the data of the bad title. On the right, there should be another API to deal with. The API to get details. You don't need so much li, on the right. You just need a div


. Actually, a better way is for you to create an internal data set. Have a stable id, for each title element on the left (globally unique and unaffected by Filter, etc.), and then query to this id according to the click to display the data on the right.
is to find a way to maintain a corresponding table of index and id so that the correct data can be queried.

Menu