Hi,

I'd like to create a periodical Ajax request with jQuery. What i have
done is:

$j.ajax({
  type: "POST",
  url: "/ajaxpro/haschanged.ashx",
  data: '{"req":' + AjaxPro.toJSON(r) + '}',
  beforeSend: function(xhr) {
    xhr.setRequestHeader("X-AjaxPro-Method", "HasChanged");
  },
  success: function(s) {
    mt.refresh_callback({value:res});
  },
  error: function(request, settings) {
    alert("Ajax error");
    mt.isUpdating = false;
    setTimeout(mt.refresh_handle, 1000);
  }
});


mt.commonData is a simple JS object which has a callback and refresh
method.

var mt = {
  isUpdating: false,
  refresh_callback: function(res) {
  },
  refresh: function() {
     this.isUpdating = true;
     // here is the Ajax request from above
  },
  initialize: function() {
    this.refresh_handle = this.refresh.bind(this);
  }
}


What I see is that memory is growing on every request.

Maybe anybody can help me on writing a periodical Ajax updater?!

Michael

Reply via email to