jQuery ajax请求后渲染数据在前端页面

第一步定义一个div或者html有的标签

 

第二步,异步请求( interfaceId  传递参数)

 $.ajax({
                        url: "/CatalogApiDetail/getCatalogInerfaceStatusList",
                        type: "post",
                        data: {
                            interfaceId: interfaceId
                        },
                        dataType: "json",
                        success: function(resultData) {
                            //var methodId=data.methodList.length;
                            
                            if(resultData!=null&&resultData!=""){
                                var data4 = eval(resultData);
                                var Str2="";
                                for(var k in data4){
                                    Str2+="";
                                    Str2+=" "+data4[k].statusCode+"";
                                    Str2+=" "+data4[k].statusDesc+" ";
                                }  
                             $(".cuWuMa").html(Str2);   

                            }
                                    
                                                       
                        }
                    });

 

第三步,请求数据接口,取得数据,返回一个json数据

第四步,渲染页面     $(".cuWuMa").html(Str2);   

var Str2="";
                                for(var k in data4){
                                    Str2+="";
                                    Str2+=" "+data4[k].statusCode+"";
                                    Str2+=" "+data4[k].statusDesc+" ";
                                }  
                             $(".cuWuMa").html(Str2);   

 

 

你可能感兴趣的:(java,Web)