javascript – jQuery AJAX POST – 数据不会被发送

$.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()的返回值与期望的参数不一致.

在这种情况下,您的错误函数应该是接收内部服务器错误[500]

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...