Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstackreduce.js
More file actions
Latest commit
58 lines (51 loc) · 1.71 KB
/
Copy pathstackreduce.js
File metadata and controls
58 lines (51 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/******************************************************************
StackReduce API Wrapper Library
Version: 0.1.rc1 BETA
Requires: jQuery 1.10.1
Author: Yannis Kolovos
*******************************************************************/
if(typeofjQuery=='undefined'){
functiongetScript(url,success){
varscript=document.createElement('script');
script.src=url;
varhead=document.getElementsByTagName('head')[0],
done=false;
script.onload=script.onreadystatechange=function(){
if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){
done=true;
success();
script.onload=script.onreadystatechange=null;
head.removeChild(script);
};
};
head.appendChild(script);
};
// getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js', function() {
getScript('https://raw.github.com/stackreduce/stackreduce-js/master/jquery_custom_build.js',function(){
console.log("Loaded")
});
}
/******************************************************************
Main StackReduce Object
Keep it simple!
*******************************************************************/
varStackReduce=(function(sr){
sr.end_point="http://www.stackreduce.com/api/v1/stacks.json"
sr.push=function(data){
$.ajax({
type: "POST",
url: this.end_point,
dataType: "json",
data: {
_method:'POST',
token:this.settings.token,
app_id:this.settings.app_id,
stack_data:JSON.stringify(data)},
success: function(data)
{
console.log(data)
}
});
}
returnsr;
}(window.StackReduce||{}));