Template:UpdateStore

    Table of contents
    No headers
    dekiapi();
    var channel = $subscribe ?? 'default';
    var store = $id ?? 'data';
    <script type="text/jem">"
    	Deki.subscribe('"..channel.."', null, function(c, m, d) {
    		var prop = 'urn:custom.mindtouch.com#'  + '"..store.."';
    		Deki.Api.ReadPageProperty(null, prop, function(result) {
    			var data = eval('(' + (result.value || '[]') + ')');
    			data.push(m);
    			if(result.etag) {
    				Deki.Api.UpdatePageProperty(result.href, YAHOO.lang.JSON.stringify(data), result.etag, function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to update the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			} else {
    				Deki.Api.CreatePageProperty(null, prop, YAHOO.lang.JSON.stringify(data), function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to create the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			}
    		}, function(result) {
    			alert('An error occurred trying to read the store (status: ' + result.status + ' - ' + result.text + ')');
    		});
    	}, null);
    "</script>
    
    Tag page (Edit tags)
    • No tags
    Page statistics
    97 view(s), 8 edit(s) and 1247 character(s)

    Comments

    You must login to post a comment.

    Attach file

    Attachments