Ajax调用中的radius:true选项和false之间有什么区别? [英] What´s the difference between traditional:true option and false in Ajax call?

查看:96
本文介绍了Ajax调用中的radius:true选项和false之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有这些都是为了丢弃MVC控制器的问题.

All of this is for discard a problem with a MVC controller.

这是ajax的代码:

 $.ajax({
            //tipo de transferencia
            type: "POST",
            //dato a enviar
            dataType: 'Json',
            traditional:true,
            //enviar variable previamente formada contiene la estructura del modelo
            data:data,

            //liga previamente asignada esta liga contiene  la ruta controlador-metodo
            url: url,

注意传统的:真.

推荐答案

jQuery API文档

http://api.jquery.com/jQuery.Ajax/# jQuery-ajax设置

传统

类型:布尔

如果您想使用 参数序列化的传统样式.

Set this to true if you wish to use the traditional style of param serialization.

traditional属性更改了将参数发送到服务器的方式.从jQuery 1.8开始,它默认为false.

The traditional property changes the way how parameters are sent to the server. As of jQuery 1.8, it is defaulted to false.

对于ASP.NET MVC开发人员

$.ajax(url, {
   data : { a : [1,2,3] },
   traditional : true
}));

// `data` are sent as "a=1&a=2&a=3" 

如果traditional设置为false,则数据将作为a%5B%5D=1&a%5B%5D=2&a%5B%5D=3

If traditional was set to false the data would be sent as a%5B%5D=1&a%5B%5D=2&a%5B%5D=3

从此线程中删除的答案

这篇关于Ajax调用中的radius:true选项和false之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆