对比两边提交的请求头信息发现问题出现在Content-Type,
IE下是Content-Type application/x-www-form-urlencoded;
而firefox等其他浏览器下是Content-Type application/x-www-form-urlencoded; charset=utf-8 ,
IE没有设置charset=utf-8,
解决办法一:
设置全局的Content-Type
$.ajaxSetup({contentType:"application/x-www-form-urlencoded; charset=utf-8"});
解决办法二:
$.ajax({
type: ’POST’,
url: url,
data: data,
success: success,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
dataType: dataType
});
解决办法三:
$.ajax({
type: ’POST’,
url: ’http://www.taobye.com/xxx.html?name="’+encodeURI($(dom).val(), "UTF-8")+’"’,
success: success,
dataType: dataType
});