我有一个从中选择值的弹出窗口。当我选择值时,控件通过 ajax 调用转到服务器,并在回调方法中生成了 HTML 页面。
我试图将值设置为 div 这样的 div。
$("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());
当我使用上面的行时,该值div
第一次被设置为,但在那之后,每当我选择一个新值并且发生 ajax 调用时,该值都没有被设置并且我第一次设置的值遗迹。
更新:
我用来设置值的 ajax 方法:
function getCustomerDetails(customerName,viewName) {
var global = window.document
$.ajax({
type: "POST",
url: viewName,
data: {
id: customerName
},
success: function (msg) {
global.getElementById("CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").innerHTML = $('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html();
alert($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());
alert($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod', msg).html());
$("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_CustomerName', msg).html());
$("#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod").replaceWith($('#CIMtrek_dvDialogListCtrlPlaceholder_CIMtrek_DailyshipCo_PackingMethod', msg).html());
}
});
}
如何将新值更新到 div?