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

  • 相关阅读:
    Java基本数据类型的包装类
    Java数据类型基础
    Xscan安装
    Notepad++配置HexEditor插件
    [WP]XCTF-re2-cpp-is-awesome
    [WP]XCTF-tt3441810
    [WP]XCTF-re1-100
    [WP]XCTF-Mysterious
    [WP]xctf-parallel-comparator-200
    [WP]XCTF-elrond32
  • 原文地址:https://www.cnblogs.com/luminji/p/4685127.html
Copyright © 2011-2022 走看看