你可以去掉那一行,保持默认contentType Default: 'application/x-www-form-urlencoded' When sending data to the server, use this content-type. Default is "application/x-www-form-urlencoded", which is fine for most cases. If you explicitly pass in a content-type to $.ajax() then it'll always be sent to the server (even if no data is sent). Data will always be transmitted to the server using UTF-8 charset; you must decode this appropriately on the server side.
datatype:"text";})
试试
你指定了JSON格式的吧,改成contentType: "application/text; charset=utf-8",
请问为什么要这样改,不能用json或者什么使用用呢
比如,返回多个键值对,或返回集合的键值对,用JSON就比较方便了,可以以面向对象的方式操作数据
你指定了JSON格式的吧,改成contentType: "application/text; charset=utf-8",这个也不可以
Default: 'application/x-www-form-urlencoded'
When sending data to the server, use this content-type. Default is "application/x-www-form-urlencoded", which is fine for most cases. If you explicitly pass in a content-type to $.ajax() then it'll always be sent to the server (even if no data is sent). Data will always be transmitted to the server using UTF-8 charset; you must decode this appropriately on the server side.
可参看http://blog.csdn.net/wlkjhxd/archive/2009/07/22/4369084.aspxhttp://www.cnblogs.com/regedit/archive/2008/03/04/1089948.html