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",
});

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);
    }
});

JQuery ajax url传值与data传值的区别的更多相关文章

  1. jQuery Ajax url使用方式

    jQuery Ajax的使用场景: 页面需要通过后台逻辑,但只需要局部刷新以显示新的内容. jQuery Ajax url使用方式1.servlet方式: 需要在struts.xml中写一个actio ...

  2. Jquery - ajax url路径问题

    Jquery - ajax url路径问题 2016年04月26日 09:59:27 yuxuac 阅读数 32308    版权声明:本文为博主原创文章,未经博主允许不得转载. https://bl ...

  3. layui jquery ajax,url,type,async,dataType,data

    $.ajax({ url: '/foensys/user/userDelete/'+data[0].id, type:"get", async:true, dataType:&qu ...

  4. jQuery.ajax(url,[settings])

    概述 通过 HTTP 请求加载远程数据. jQuery 底层 AJAX 实现.简单易用的高层实现见 $.get, $.post 等.$.ajax() 返回其创建的 XMLHttpRequest 对象. ...

  5. jQuery AJAX Call for posting data to ASP.Net page ( not Get but POST)

    the following jQuery AJAX call to an ASP.Net page. $.ajax({ async: true, type: "POST", url ...

  6. 在jQuery ajax中按钮button和submit的区别分析

    在使用jQuery ajax的get方法进行页面传值,不能用submit,否则无刷新获取数据展示 点击submit提交按钮,sendPwd.php通过$_POST接收传过来的值,然后echo一段数据. ...

  7. UI5-技术篇-jQuery.ajax执行过程中Token验证及JSON格式传值问题

    最近两天在测试OData服务类方法CREATE_DEEP_ENTITY及GET_EXPANDED_ENTITYSET,刚开始采用ODataModel方式调用没有任何问题,但是ODataModel采用的 ...

  8. JQuery.Ajax()的data参数类型

    假如现在有这样一个表单,是添加元素用的. <form id='addForm' action='UserAdd.action' type='post'> <label for='un ...

  9. jQuery +ajax +json+实现分页

    正文 首先我们创建一般处理程序,来读取数据库中内容,得到返回值. 创建文件,GetData.ashx. 我这里是用的存储过程,存储过程会再下面粘出来,至于数据只是实例,你们可根据需求自行读取数据 代码 ...

随机推荐

  1. codeforces 360 C - NP-Hard Problem

    原题: Description Recently, Pari and Arya did some research about NP-Hard problems and they found the  ...

  2. UART UVM验证平台平台搭建总结

    tb_top是整个UVM验证平台的最顶层:tb_top中例化dut,提供时钟和复位信号,定义接口以及设置driver和monitor的virual interface,在intial中调用run_te ...

  3. linux系统man命令用法和安装方法

    Linux提供了丰富的帮助手册,当你需要查看某个命令的参数时不必到处上网查找,只要man一下即可. Linux的man手册共有以下几个章节: 代號 代表內容 1 使用者在shell中可以操作的指令或可 ...

  4. [转] Oracle analyze 命令分析

    转自:http://blog.sina.com.cn/s/blog_682841ba0101bncp.html 1.analyze table t1 compute statistics for ta ...

  5. Spring IOC容器中注入bean

    一.基于schema格式的注入 1.基本的注入方式 (属性注入方式) 根据setXxx()方法进行依赖注入,Spring只会检查是否有setter方法,是否有对应的属性不做要求 <bean id ...

  6. 修改eclipse中settings.xml和默认资源库保存地址

    1.打开eclipse 2.window-->references-->Maven0-->User Settings:修改User Settings,Browse重新选择新位置D:\ ...

  7. 管理权限<八>

    权限:如果用户要访问其它方案的对象,则必须为其授予对象的权限.为权限  权限 权限是指执行特定类型 sql 命令或是访问其它方案对象的权利,包括系统权限和对象权限两种. 系统权限  系统权限介绍 ...

  8. 【jQuery】: 定时刷新页面

    <%@page import="qflag.ucstar.seatmonitor.manager.SeatMonitorManager"%><%@ page la ...

  9. ADO.NET Entity Framework学习笔录(一)

    今天开始学习了EF的相关内容,以前只知道ADO.NET,今天学习后觉得有必要写个相关的学习心得,今天就先写第一篇. 我们的再学习的过程中所用到的环境是Windows7+SQLServer2008+VS ...

  10. ubuntu搭建svn服务器(转)

    在阿里云买了个服务器,想上传东西,samba不好用,想起来可以搭个svn用,找到了这篇. 1. 安装SVN apt-get install subversion 2. 建立svn仓库 1). 建立sv ...