Spring MVC 使用ajax时,控制器无法获取客户端参数

原因是

$(document).ready(function(){
$("#submit").click(function (){
alert("123");
jQuery.ajax({
type:'POST',

 contentType: 'application/json',//多了这一句!!!!!!
data:{foo:"哇嘎"},
dataType:'json',
   url : '../getStudentsByName.action',  
       success : function(data) {  
       alert("success!");  
         },  
         error : function(data) {  
           alert("error");  
         }  
});
});

});

你可能感兴趣的:(spring,mvc,Ajax)