0
我在我的形式不同列表需要AJAX成功後,文本框的值賦給UI列表
<c:forEach items="${cmlist}" var="records">
<ol class="dd-list" id="chapterlist" >
<li id="cs" class="dd-item" data-id="1" value="${records.levelID}">
<div class="dd-handle">
<a href="#subchaptercontent">Chapter: ${records.levelName} </a>
<img class="hand-cursor" alt="" src="../resources/images/edit.png"
title="edit" id="edit_record_btn" style="float:right;margin-top:-20px;"
data-toggle="modal" data-target="#windowTitleDialog"
onclick="javascript:editChapter(${records.levelID})">
</div></li>
</ol>
</c:forEach>
我有AJAX功能用於存儲後存儲列表值到數據庫中,我需要打印在榜單的價值,但我不需要加載瀏覽器只需從文本框中分配值列表。 如何做到這一點 這裏我AJAX功能:
var sampName = document.getElementById("sampName").value;
$.ajax({
type : "post",
url : "editSamplee?clg="+clg,
data: JSON.stringify(courseStructureData),
dataType:'json',
contentType:'application/json',
mimetype:'application/json',
cache : false,
beforeSend : function(xhr) {
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
},
success : function(response) {
console.log("Success: ");
//window.location = "coursecontentmain?clg="+clg;
$("#windowTitleDialog").hide();
$(".modal-backdrop fade in").hide();
$(".modal-body").hide();
sampName=$("#chapterlist li a").parents('li').text() ;
},
error : function(xhr) {
console.log("Sorry, there was a problem! " + xhr.status);
},
complete : function() {
console.log("Request complete");
}
});
能否請你幫助別人