Jquery--ajax

--实例:

$.ajax({
        url: '/location/get_location_top_module',
        type: 'post',
        data:{
            state: state,
            county: county,
            zip: zip,
            city: city,
            page_type: page_type
        },
        success: function(data){
            if(data.top_results !== undefined && data.top_results !== null && data.top_results.length > 0){
                top_html = "";
                $.each(data.top_results, function(i, value){
                    top_html += '<div>';
                    top_html += value;
                    top_html += '</div>';
                });
                $(".location-container").addClass("location-left");
                $(".location-top-container").html(top_html);
            }
        },
        error: function(){
            
        }
    });

  

posted @ 2016-09-23 12:58  盖瑞  阅读(127)  评论(0编辑  收藏  举报