My idea is this, when clicking the a tag of the html, pass the id of p through the url to be received by another js page, and then use this id to match in the array (TU), if id== tuid outputs the data of the group where the tuid is located one by one to the corresponding location of an html page.
Now I have received the value, but I don’t know how to match the data in the data and then output the required data. Please give me some advice, seniors.
Received id:
var productNo=common.getQueryString("productNo");
The array structure is as follows:
var TU = [{
"tuid":"xy0001",
"imgurl":"img/178.jpg",
"title":"安全椅",
"cost":"86"
},
{
"tuid":"xy0002",
"imgurl":"img/178.jpg",
"title":"时尚包",
"cost":"96"
},
{
"tuid":"xy0003",
"imgurl":"img/178.jpg",
"title":"娃娃",
"cost":"89"
}
]
html page:
<p class=“xsy”>
<img src="{{imgurl}}">
<h1>{{title}}</h1>
<p>{{cost}}</p></p>
Initialize a variable, which is empty by default.
Assign the passed value to this variable,
Loop through