Javascript 根据控制器返回的属性捕获ajax响应

Javascript 根据控制器返回的属性捕获ajax响应,javascript,jquery,json,ajax,spring-mvc,Javascript,Jquery,Json,Ajax,Spring Mvc,我有一个ajax函数,如下所示: } load=function(){ $.ajax({ url:“列表”, 类型:'POST', 成功:功能(响应){ data=response.data; $('.tr').remove(); 对于(i=0;这是我们在不看到差异的情况下知道的方法。发布一个最小的表示法,显示两种类型之间的差异。您如何具体决定发送哪种类型?@charlietfl我有一个控制器,如果返回用户属性,则处理if和else语句上的用户数据,如果else返回adminattributes

我有一个ajax函数,如下所示:

}

load=function(){
$.ajax({
url:“列表”,
类型:'POST',
成功:功能(响应){
data=response.data;
$('.tr').remove();

对于(i=0;这是我们在不看到差异的情况下知道的方法。发布一个最小的表示法,显示两种类型之间的差异。您如何具体决定发送哪种类型?@charlietfl我有一个控制器,如果返回用户属性,则处理if和else语句上的用户数据,如果else返回adminattributes@charlietfl它是d基于单选按钮值进行确定,该值将作为用户的输入,并在我的dao中处理该值,该值自动连接到我的控制器OK,因此,如果选择该单选按钮,则您知道返回的数据类型。因此,不清楚具体问题是什么
$.ajax({// defining the below function as ajax responsive//
    url:'Type&State', // the function that process the  mapped url name and matching type is going to receive the data//
    type:'POST',
    data:{state_name:name,case_type:type},// function to get the value from jsp page and send it to mapped class function//
    success: function(response){// if the backend process is success then the function will run by getting the response as its parameter//
            alert(response.message);
            load();
    },
    error: function(response){
          alert("unable to pull up any electricians or plumbers for the selected state");
                        }   
});         
load = function(){  
    $.ajax({
        url:'list',
        type:'POST',
        success: function(response){
                data = response.data;
                $('.tr').remove();
                for(i=0; i<response.data.length; i++){                  
                    $("#table").append("<tr class='tr'> <td> "+response.data[i].user_name+" </td> <td> "+response.data[i].user_email);
                }           
        }               
    });