zoukankan      html  css  js  c++  java
  • JQuery ajax url传值与data传值的区别

    url传中文,乱码,即便charset为 UTF-8,

    $.ajax({
        type: "POST",
        cache: false,
        url: "/ProductTypeAndCat/AddType?typeName=" + typeName,
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        datatype: "JSON",
    });

    image

    data传中文,正确。

    $.ajax({
        type: "POST",
        cache: false,
        url: "/ProductTypeAndCat/AddType",
        data: {typeName:typeName},
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        datatype: "JSON",
        success: function (data) {
            if (data.F == 0) {
                alert("添加陈功");
                location.href = "/Admin/ProductType";
            }
            else {
                alert(data.M);
            }
        },
        error: function (xhr, status, error) {
            alert(error);
        }
    });

    image

    image

  • 相关阅读:
    预编译命令 #if DEBUG
    conda常用命令
    tensorflow 安装指南
    LocNET和池化理解
    同时安装cuda8和cuda9
    np.transpose
    python中List的slice用法
    书单
    训练工程
    linux 查看进程
  • 原文地址:https://www.cnblogs.com/luminji/p/4685127.html
Copyright © 2011-2022 走看看