我需要将 jquery 对话框的标题发送到服务器,是否可以在不遍历 DOM 并找到它的情况下检索它?
我知道 ( <span class="ui-dialog-title"></span>
) 可以使用 jQuery 检索,但我想知道是否有更好的方法。
$(c[0]).html(html).dialog({
title: "Brief Country List",
resizable: false,
draggable: false,
width: 900,
modal: true,
autoOpen: true,
buttons: {
Done: function () {
Neptune.BriefCountrySection.SaveCountry();
},
Export: function () {
$.ajax({
type: 'POST',
url: '/Briefs/ExportCsv',
data: /*Get the title here*/,
dataType: 'JSON',
contentType: 'application/json; charset=utf-8',
success: function (res) {
if (res.Success) {
var item = ko.utils.arrayFirst(self.Countries(), function (i) {
return i.ListID() == self.SelectedCountryListID();
});
if (item != null) {
self.Countries.remove(item);
}
}
else {
Neptune.ShowAlert({ content: res.FriendlyErrorMessage });
}
},
error: function (jqXHR, status, err) {
Neptune.ShowAlert({ content: status });
}
});
}
}
});
}