Home > front end >  The bootstrap accordion accordion folded effect failure using ajax to dynamically generate the data
The bootstrap accordion accordion folded effect failure using ajax to dynamically generate the data

Time:09-29

For help, in the use of ajax to generate the data and then use the bootstrap comes to generate the corresponding effect of the features of the accordion accordion, but due to dynamic loading, accordion accordion cannot all normal folding, some can be expanded to some no,

Pure CSS + HTML implementation accordion effect, no JS, could you tell me how to solve the problem? Haven't seen the corresponding method checked a lot of,

People think it is because the ajax dynamic loading, the accordion effect no auto-refresh data, then some normal some abnormal problems, because the f12 when debugging all data is out of, is the problem about can not be normal,

Please comment,

This is where the HTML
 

Lorem & lt;/p>




-->





It's about ajax generated code
 
//related q&a data acquisition and present
GetData3 ();
The function getData3 () {
Var num=20;
Var $ul=$(" list2 div ");//show the q&a list
$. Ajax ({
Type: "get",
Url: "forum. PHP,"
Data: {type: "get3," page: the page, num: num},
DataType: "json",
Success: the function (json) {
The console. The log (json);
If (json. The error==0) {
$ul. HTML (" ");
For (var I=0; I & lt; Json. Data. Length; I++) {
Var $li=$(' & lt; Div & gt;
. '+ json data [I]. Answer +' & lt;/p>
');
$ul. Append ($li);
$li. The show ();
Var $a=$li. Find (" a ");
$a.o n (" click ", function () {
Var $li=$(this). Parents (" li ");
Del ($(this). Attr (' dataid '), $li);
})
}
} else {
//alert (" no data ");
}
},
Error: function () {
Alert (" attempt failed!" )
}
})
$(' accordion '). Accordion (" refresh ");
}


This is a show doesn't open mode code


This is a successful debugging code
  • Related