A performant Javascript object that provides an Ajax framework.
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();
url: 'Request Url'
type: 'POST'
Set to GET or POST. Can be set to other methods if the host allows them.
data: {
param1: value1,
param2: {
key1: value1,
key2: value2
},
param3: "value3",
param4: value4,
foo2: ["bar2", "bar 3", "bar+4"]
}
success: function(data){
alert(data);
}
method: true
True for async, false for sync. Defaults to true.
debugLog: false
Set to true to show debugging log. Defaults to false.
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();
Twitter: @lumberjackchef
Website: ryanpearson.net