RestPersisnteceManager reimplemented with ajax

This commit is contained in:
Ezequiel Bergamaschi
2014-08-03 16:50:06 -03:00
parent df9f865e04
commit 4ac182f0d9
2 changed files with 23 additions and 49 deletions

View File

@@ -14,32 +14,30 @@ function createStorageManager(mindplot) {
saveMapXml : function(mapId, mapXml, pref, saveHistory, events) {
var url = this.backendUrl + mapId;
var xmlRequest = new Request({
$.ajax({
url: url,
method: 'post',
async: false,
onSuccess: function(responseText) {
events.onSuccess();
},
success: function(responseText) {
events.onSuccess();
},
onError: function (text, error) {
console.log("Error saving mindmap to: " + url, text, error);
events.onError();
}
});
xmlRequest.send();
},
loadMapDom : function(mapId) {
var xml;
var xmlRequest = new Request({
$.ajax({
url: this.backendUrl + mapId,
method: 'get',
async: false,
onSuccess: function(responseText) {
success: function(responseText) {
xml = responseText;
}
});
xmlRequest.send();
// If I could not load it from a file, hard code one.
if (xml == null) {