For start i fetch input from html and search database containing that input, after when i print it in java to check if it works fine, but when i try to console log that same data i get empty object:
Object {  }
My js:
var type = document.getElementById("typeInput");
$('#search').on('click', function(event) {
    var kategorija = type.options[k.selectedIndex].value;
    var json = $("#json");
    console.log(json);
    var params = {
        'type' : type,      
    };
    $.get('ResServlet', params, function(data){
    var json = $("#json");
    console.log(json);
})
my java code:
    String type = request.getParameter("type");
    type = (type != null? type: "");
    System.out.println(kategorija);
//  ServletContext context = getServletContext();
    System.out.println("------------");
    List<Res> ress = ResDAO.getRes(type);
    System.out.print(ress);
    System.out.println("\n");
    System.out.println("+++++++++++");
    String json = new Gson().toJson(ress);
    System.out.print(json);
    request.setAttribute("json", json);
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");
    response.getWriter().write(json);
When i print data with System.out.print(json) i get proper json but when i try to console.log in js i get : Object { } or just Array [] when i to get values from that json. Sorry for noob question i just started using javascript :)
