<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" language="javascript">
// when the document has finished loading, get the data
$(document).ready(GetData());
function GetData() {
$.ajax({
beforSend: function () {
$('#loadingDiv').css('display', 'block')
},
complete: function () {
$('#loadingDiv').css('display', 'none')
},
type: "GET",
url: "/Integrationsonify/Data.aspx",
data: dataObject,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var header = $("#accordion");
$.each(data, function () {
header.append("<a href='javascript:toggleDiv();'>" + this.Name + " </a>", "<div id='myContent' style='display:none'>" + "<ul>", "<li>" + this.Id + "</li>", "<li>" + this.SName + "</li>", "</ul>" + "</div");
});
},
error: function () {
alert("There was an error while rendering the page. Please contact the Admin for details");
}
});
}
function toggleDiv() {
$("#myContent").toggle();
}
</script>
<div id="loadingDiv" style="display: block;">
hi
</div>
<div id="accordion">
</div>
myContent divを切り替えることができません。ajax呼び出しで作成されたためですか?divは表示されますが、ページのソースを表示すると、アコーディオンdiv内のデータが表示されません。ただし、ブラウザーのUI側では、少なくともデータを表示できます。ありがとうございます。非常に基本的な質問ですが、私はすぐにこれから抜け出す方法を見つける必要があるので、私を案内してください...