Ajax

Abstraction method for XMLHttpRequest

Karma.ajax( options )

Options

  • type: (string) can be 'GET' or 'POST', defaults to 'GET'
  • url: (string, required) the URL of the document
  • data: (string) serialized data to be passed the document, defaults to ''
  • contentType: (string) Sets the content type header.
  • loading: (function) Runs when the request has started.
  • success: (function) Runs when the request has successfully completed.
  • error: (function) Runs when the request has encountered an error.
  • XHR: (XHR object) Uses the provided XHR object instead of the default.
Karma.ajax({
  type: 'POST',
  url: 'ajax.php',
  data: 'sex=male&age=12',
  success: function(o) {
    alert(o);
  }
});
 
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki