项目中有涉及到页面穿件对象,传值到后台的业务
_txtName.focus();
var getData = function() {var networkSegmentData = {
name:_txtName.val(),
description:_txtDescription.val(),
startIpAddress:_txtStartIpAddress.val(),
endIpAddress:_txtEndIpAddress.val(),
gateway:_txtGateway.val(),
primaryDns:_txtPrimaryDns.val(),
subordinaryDns:_txtSubordinaryDns.val()
};
var data = $.extend(true, {}, _data, networkSegmentData);
return data;
};
// commit
_btnNetworkSegmentAddSave.on(EventType.CLICK,function() {
MessageDialog.loading();
HttpUtils.ajax({
url: CONTEXT + "/webui/virtualresource/networkSegment/create",
contentType: "application/json",
data: JSON.stringify(getData()),
success: function(result, textStatus, jqXHR) {
MessageDialog.loading(false);
window.location.href="/webui/virtualresource/networkSegment/home?newQuery=false";
},
error: function(jqXHR, textStatus, errorThrown) {
if(jqXHR.responseText) {
var data = JSON.parse(jqXHR.responseText);
MessageDialog.loading(false);
MessageDialog.error(data.message);
}
}
});
});