I try to send data from the servlet in JSON in JavaScript using the response.getWriter().write(JSON) method, but I get into an infinite loop.
String JSON = builder.toJson(Complete_map); response.setContentType("text/plain"); response.getWriter().write(JSON); Complete map - HashMap of string values. I use GSON library. But no matter what I gave, there is always an endless cycle.
function show_Value() { function MapObject(name,value,mutter) { this.name= name; this.value = value; this.mutter = mutter; } $.ajax({ url:'show_Registers', success : function(responseText) { var map = String.valueOf(responseText); var p = JSON.stringify(map); $('#MyFuckingMap').text(p); setTimeout(500,show_Value()); } }); } And this thing happens only in Google Chrome , Opera and IE , the data in ajax , apparently do not come.