Skip to main content

Bug Tracker

Side navigation

Ticket #7017: mytest.js
File mytest.js, 0.9 KB (added by zorneck, September 22, 2010 12:11PM UTC)

The javascript test code

$(document).ready(function() {
  jQuery('body').ajaxStart(function(){
    alert( "ajaxStart" );
  }).ajaxStop(function(){
    alert( "ajaxStop" );
  }).ajaxSend(function(){
    alert( "ajaxSend" );
  }).ajaxComplete(function(){
    alert( "ajaxComplete" );
  }).ajaxError(function(){
    alert( "ajaxError" );
  }).ajaxSuccess(function(){
    alert( "ajaxSuccess" );
  });
  
  $('#AjaxTestButton').click(function() {
    var TestObj = new AjaxTest('ajaxtest.html');
    TestObj.send();
  });
});

AjaxTest = function(url) {
  this.url = url;
}

AjaxTest.prototype = {
  send: function() {
    jQuery.ajax({
      url: this.url,
      beforeSend: function(){ alert("beforeSend"); },
      success: function(data){
        alert("success");
        $('#AjaxResponse').html(data);
      },
      error: function(){ alert("error"); },
      complete: function(){ alert("complete"); },
      context: this
    });
  }
}

Download in other formats:

Original Format