Home > front end >  Js, how to obtain the dynamic id
Js, how to obtain the dynamic id

Time:10-08

Post code first:
1. The HTML page
 


2. Js
 
Var limit=8;
Var currentPage=0;
Var total;
$(function () {
BindList (0);
});
The function nextPage () {
BindList (currentPage * limit)
}
The function bindList (offset) {
$
Ajax ({
Url: 'nav/content/open/list? NavigationId=0 & amp; ParentId=30 & amp; Limit=8 & amp; Offset='+ offset,
Method: 'get',
DataType: 'json,
Success: the function (data) {
Var rows=data. Rows;
Total=data. The total;
Var htmlText="";
For (I=0; I & lt; Rows. Length; I++) {
HtmlText +='& lt; Div & gt; ';
HtmlText +='& lt; A href="https://bbs.csdn.net/nav/content/open/post/" + rows [I] cid + '" & gt; ';
HtmlText +='& lt; The h2 & gt; ';
HtmlText +=rows [I]. Title;
HtmlText +='& lt;/h2 & gt; ';
HtmlText +='& lt;/a> ';
HtmlText +='& lt; P & gt; Author: & lt; A href="https://bbs.csdn.net/topics/#" & gt; '
+ rows [I]. The author
+ '& lt;/a> & nbsp; & nbsp; '
+ rows [I] createTime + '& lt;/p> ';
HtmlText +='& lt;/div> ';
HtmlText +='& lt; Hr> ';
}
$(". IncomeNum "). Append (htmlText);
}
});
}


Because I pass the url of the belt in js two parameters "navigationId" and "parentId", I want to pass in the HTML and traverse the id, can show different "${navigation. NavigationName}" the corresponding different information list, don't know whether this idea, if how should set up the id?
O bosses told!

CodePudding user response:

Your ultimate meaning probably can understand, certainly can do, but your code and description is some fuzzy, can't a specific answer