$.ajax({
url: "/Configuration/AddServersAdvancedSelect",
type: "POST",
data: { selectedOUs: that.getByDataSelected() },
async: false,
dataType: "html",
success: result => {
cont.setTabContentFromHtmlString(result, 1);
cont.tabClicked($("td[data-value='1']").get(0));
},
error: (xhr, ajaxOptions, thrownError) => {
//
}
});
编辑:我今天回来工作,它神奇地开始工作.我猜那是件好事
这是我对服务器的ajax请求.由于某种原因,数据未被选中. getByDataSelected函数就像它应该的那样工作并重新设置好的值. Controller方法的名称为selectedOU,一切都匹配.有没有人知道为什么这个ajax POST不发送数据?
解决方法:
jQuery将数据参数定义为
Type: PlainObject or String or Array
Data to be sent to the
server. It is converted to a query string, if not already a string.
It’s appended to the url for GET-requests. See processData option to
prevent this automatic processing.Object must be Key/Value pairs.
If value is an Array, jQuery serializes multiple values with same key
based on the value of the Traditional setting (described below).
我愿意打赌,如果没有发送,那么你的.getByDataSelected()的返回值与期望的参数不一致.