Actions
InitializeSubscriber JavaScript¶
$.ajax({
url: sqlitesync_SyncServerURL + "InitializeSubscriber/" + sqlitesync_syncPdaIdent,
method: 'GET',
scope: this,
cache: false,
timeout: 10 * 60 * 1000, //4min
success: function (response, status) { //Success Callback
var responseReturn = JSON.parse(response);
sqlitesync_AddLog('<p>Connected to server...</p>');
sqlitesync_DB.transaction(function (tx) {
Object.keys(responseReturn)
.sort()
.forEach(function(v, i) {
tx.executeSql(responseReturn[v],
null,
function (transaction, result) {
sqlitesync_AddLog('Creating object <b>' + v + '</b>...');
},
function (transaction, error) {
console.log('Object ' + v + '; ' + error.message + ' (Code ' + error.code + ')');
});
});
}, function (error) {//error
sqlitesync_AddLog('<p>Error while syncing with the server ' + error + '</p>');
}, function () {
sqlitesync_AddLog('<p style=\"font-weight:bold; color:green;\">Synchronization completed</p>');
});
},
failure: function (result, request) {
var statusCode = result.status;
var responseText = result.responseText;
sqlitesync_AddLog('<p>Error while syncing with the server ' + responseText + '</p>');
}
});
Updated by Tomek Dziemidowicz over 5 years ago · 1 revisions
Go to top