解决ajax中文乱码

function save(buttonObj){
	var jObj = $(buttonObj);
	title = jObj.attr("title");
    address = jObj.attr("address");
    var phoneNumber = jObj.attr("phone");
    lon = jObj.attr("lon");
    lat = jObj.attr("lat");
	$.ajax({
	   url:'../map-ajax/saveArrival.action?a='+Math.random(),
	     data : {
	  		poiName:encodeURI(title),
	  		poiAdd:encodeURI(address), 
	  		poiTel:phoneNumber,   
	  		poiLon:lon, 
	  		poiLat:lat,
	  		poiType:"1"  
		},
	     type:'post',
	     dataType:'json', 
         success:function(data){
         	if(data.alertMessage != null && data.alertMessage != ""){
	         	alert(data.alertMessage);
         	}else{
         		alert("保存失败,请重试再试!");
         		
         	}
         }
	});	
}

后台解析

    	String poiName = URLDecoder.decode(request.getParameter("poiName"),"utf-8");



你可能感兴趣的:(json,Ajax,String,function,null,url)