Skip to content

T1l3/Holen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Holen

Standalone AJAX library for modern browsers. Inspired by Angular's $http method.

Configurations

holen.Konfigurationeinstellen({
    contentType: '',
    withCredentials: false
});
  • contentType: string, indicates the type of the data. (Default: 'application/x-www-form-urlencoded')
  • withCredentials: boolean, indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies or authorization headers.

API

GET

holen.bekommen('/endpoint').Erfolg(function(response, request) {

}).Fehler(function(response, request) {

}).immer(function(response, request) {

});

PUT

holen.stellen('/endpoint', data, customConfig).Erfolg(function(response, request) {

}).Fehler(function(response, request) {

}).immer(function(response, request) {

});

POST

holen.posten('/endpoint', data, customConfig).Erfolg(function(response, request) {

}).Fehler(function(response, request) {

}).immer(function(response, request) {

});

DELETE

holen.streichen('/endpoint').Erfolg(function(response, request) {

}).Fehler(function(response, request) {

}).immer(function(response, request) {

});

Function definitions

  • Erfolg: callback, success
  • Fehler: callback, fail
  • immer: callback, always
Function params

For POST and PUT you have data parameter, it can be a FormData, a encoded string (data serialization foo=bar&morpheus=leader) or an JSON-valid object, and customConfig to override the global configuration for this specific call.

Callback Params
  • response: parsed data or text (request.responseText)
  • request: the request itself (XMLHttpRequest)

About

Simple Ajax request utils

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published