Do you get data back from your server? What's it look like? On Fri, Jul 31, 2015, 07:04 Jamie McGowan <jamie...@gmail.com> wrote:
> Hi, > > I am writing my own storage backend in PHP and also a JavaScript plugin to > send/retrieve the data to the server. I don't want to use the default store > plugin. > > I have subscribed to the "beforeAnnotationCreated" event. When it is > fired, I attach the url to the annotation. I have also subscribed to the > "annotationCreated" event. When it is fired, I attempt to send to > annotation to the server via Ajax. However I get the following error: > *Uncaught Error: Error while finding start node: undefined: TypeError: > Cannot read property 'substring' of undefined.* > > It seems to me that the annotation object is no longer available. I have > attached the code below (hopefully the format doesn't get messed up). > I appreciate any help! > Jamie > > > > Annotator.Plugin.Storage= function(element) { > return { > pluginInit: function() { > this.annotator > .subscribe("beforeAnnotationCreated", > function(annotation) { > annotation.url = document.location.href; > }) > .subscribe("annotationCreated", function(annotation) { > console.log("Created: %o", annotation); //This works > as expected > > jQuery.post("./annotator/create.php", annotation, > function(data) { > annotation.id = data.id; > annotation.username = data.username; > annotation.timecreated = data.timecreated; > }); //This doesn't work > }) > } > } > }; > _______________________________________________ > annotator-dev mailing list > annotator-dev@lists.okfn.org > https://lists.okfn.org/mailman/listinfo/annotator-dev > Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev >
_______________________________________________ annotator-dev mailing list annotator-dev@lists.okfn.org https://lists.okfn.org/mailman/listinfo/annotator-dev Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev