<script>
function f(tt){
$.ajax({
type : "POST",
url : "{:U('index/show')}",
data : {"username" :tt},
cache : false,
dataType : "json",
beforeSend : function() {
},
success : function(msg) {
alert(msg['info']);
$("#content-fontsize").html(msg['info']);
},
error:function(){
alert(请求错误后);
}
});
}
</script>服务器端:public function show(){
header("Content-type: text/html; charset=utf-8");
$id=$_POST['username'];
if($id){
if(!is_numeric($id)){
exit();
};}
$datae=M('xinwen');
$news=$datae->where('id='.$id)->select();
//Response.ContentType = "application/json;charset=UTF-8";
$data['staus']=1;
$data['info']=$news[0]['content'];
$this->ajaxReturn($data);
//echo('ddddddddddddd');
}
在其他浏览器可以 但是在IE下 进error 最佳答案