我有一个api调用,可以很好地获取数据。它的设置使用一个按钮来打开一个可折叠的div。如果已将其打开,则在提取数据后会看到第一行或第二行,并且必须关闭/重新打开div才能查看所有数据。被卡住了一点,已经尝试了很多东西。继承人的JS
$(document).ready(function() {
function myFunction(val) {}
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("active");
var hidden_content = this.nextElementSibling;
if (hidden_content.style.maxHeight) {
hidden_content.style.maxHeight = null;
} else {
hidden_content.style.maxHeight = hidden_content.scrollHeight + "px";
}
});
}
document.getElementById('collapsible').click();
$.ajax({
type:"GET",
url:"pages/splunk_bf_data",
dataType:"json",
success:function(data){
var html = '<p>' + data + '</p>'
$('.data-container').html(html);
}
})})
答案 0 :(得分:0)
通过“完成后”功能单击两次使它变得愉快。 如果有更好/更合法的方法,请发布它。我更喜欢最佳实践。
但是我做了什么
$(document).ready(function(){
against accepting unsolicited donations from donors in such states who
approach us with offers to donate.
considerable effort, much paperwork and many fees to meet and keep up
concept of a library of electronic works that could be freely shared
editions, all of which are confirmed as not protected by copyright in
how to make donations to the Project Gutenberg Literary Archive
have not met the solicitation requirements, we know of no prohibition
including checks, online payments and credit card donations. To donate,
methods and addresses. Donations are accepted in a number of other ways
necessarily keep eBooks in compliance with any particular paper edition.
our email newsletter to hear about new eBooks.
please visit: www.gutenberg.org/donate
statements concerning tax treatment of donations received from outside
the U.S. unless a copyright notice is included. Thus, we do not
the United States. U.S. laws alone swamp our small staff.
visit www.gutenberg.org/donate
with these requirements. We do not solicit donations in locations where
works.
www.gutenberg.org
with anyone. For forty years, he produced and distributed Project
we have not received written confirmation of compliance. To SEND
DONATIONS or determine the status of compliance for any particular state
Foundation, how to help produce our new eBooks, and how to subscribe to
Gutenberg-tm eBooks with only a loose network of volunteer support.
International donations are gratefully accepted, but we cannot make any
Most people start at our Web site which has the main PG search facility:
Please check the Project Gutenberg Web pages for current donation
Professor Michael S. Hart was the originator of the Project Gutenberg-tm
Project Gutenberg-tm eBooks are often created from several printed
Section 5. General Information About Project Gutenberg-tm electronic
This Web site includes information about Project Gutenberg-tm, including
While we cannot and do not solicit contributions from states where we