Simple Data Storage


Get Data

If you're loading a remote script, be sure to set the Access-Control-Allow-Origin header to *. This is required



var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={browserid}";

var url = 'https://api.browserbucket.com/GetData/' + ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log(this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('GET', url);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.send();

Save Data

If you're loading a remote script, be sure to set the Access-Control-Allow-Origin header to *. This is required


var authdata = "?Token={token}&UserID={userid}";
var ajaxdata = authdata + "&BrowserID={browserid}";

var url = 'https://api.browserbucket.com/SaveData/' + ajaxdata;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {

console.log('Server Data: ' + this.responseText);
var obj = JSON.parse(this.responseText);

}
};
xmlhttp.open('POST', url);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.send(JSON.stringify({"name":"John", "age":30, "city":"New York"}));