Skip to content

A performant Javascript object that provides an Ajax framework.

License

Notifications You must be signed in to change notification settings

lumberjackchef/space-cat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Space Cats!

SpaceCat

A performant Javascript object that provides an Ajax framework.

Usage

  var spaceCat = new SpaceCat();

  spaceCat.config = {
    url: "http://jsonplaceholder.typicode.com/posts/1",
    type: "GET",
    data: {
      title: 'foo',
      body: 'bar',
      userId: 1
    },
    success: function(data){
      alert(data);
    }
  };

  spaceCat.ajax();

Required Arguments

url:
  url: 'Request Url'
type:
  type: 'POST'

Set to GET or POST. Can be set to other methods if the host allows them.

Optional Arguments

data:
  data: {
    param1: value1,
    param2: {
      key1: value1,
      key2: value2
    },
    param3: "value3",
    param4: value4,
    foo2: ["bar2", "bar 3", "bar+4"]
  }
success:
  success: function(data){
    alert(data);
  }
method:
method: true

True for async, false for sync. Defaults to true.

debugLog:
debugLog: false

Set to true to show debugging log. Defaults to false.

Example with all arguments

  var spaceCat = new SpaceCat();

  spaceCat.config = {
    url: "http://jsonplaceholder.typicode.com/posts/1",
    type: "GET",
    data: {
      title: 'foo',
      body: 'bar',
      userId: 1
    },
    method: true,
    debugLog: true,
    success: function(data){
      alert(data);
    }
  };

  spaceCat.ajax();

Let me know what you think!

Twitter: @lumberjackchef
Website: ryanpearson.net

About

A performant Javascript object that provides an Ajax framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published