title: Ajax request after sometime freeze browser
body: <p>I have made admin panel where setup notification alerts using ajax. It is working fine, but after few minutes than it starts to freeze the browser. Any idea what I am doing wrong, as it is my first Ajax project.</p>
  
  <p>Following are codes which I am using, I used setInterval in a function which is called by body onload event.</p>
  
  <pre><code>&lt;html&gt;    
      &lt;body onload="process()"&gt;
          &lt;-- Some notification divs to be replaced by javascript --&gt;
      &lt;/body&gt;
  &lt;html&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>&lt;script&gt;
  var xmlHttp = createXmlHttpRequestObject();
  
  function process() {
      setInterval('process()', 10000);
      if (xmlHttp) {  
         try {
             xmlHttp.open("GET", "response.json", true);
             xmlHttp.onreadystatechange = handleRequestStateChange;
             xmlHttp.send(null);
         } catch (e) {
             console.log("Can't connect to server:\n" + e.toString())
         };
      }
  }
  
              function handleRequestStateChange() {
                  if (xmlHttp.readyState == 4) {
                      {
                          if (xmlHttp.status == 200) {
                              try {
  
                                  handleServerResponse();
  
                              } catch (e) {}
  
                          } else {
                              console.log("There was a problem retrieving the data:\n" + xmlHttp.statusText);
  
                          }
                      }
                  }
              }
  
  
              function handleServerResponse() {
  
                  responseJson = JSON.parse(xmlHttp.responseText);
                  for (var i = 0; i &lt; responseJson.newbooking.length; i++) {
  
                      //   html += "&lt;li&gt;&lt;a href='admin_user.php?id=" +  + "'&gt;&lt;div class='desc'&gt;" + responseJson.users[i].first_name + ", " +responseJson.users[i].last_name + " joined&lt;/div&gt;&lt;/a&gt;&lt;/li&gt;";
  
                      bookinghtml += "&lt;li&gt;&lt;a href='makeinvoice.php?bookingid=" + responseJson.newbooking[i].booking_id + "'&gt;&lt;span class='subject'&gt;&lt;span class='from'&gt;" + responseJson.newbooking[i].company_name + " &lt;/span&gt;&lt;span class='time'&gt; " + responseJson.newbooking[i].user_name + " &lt;/span&gt;&lt;/span&gt;";
                      bookinghtml += "&lt;span class='message'&gt; from " + responseJson.newbooking[i].start_date + ", " + responseJson.newbooking[i].batches + "  " + responseJson.newbooking[i].campaign + "&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;";
                  }
  
  
  
                  myDiv = document.getElementById("bookinginfo");
                  myDiv.innerHTML = bookinghtml;
  
  
              }
  </code></pre>