Add Annotation to Openseadragon
<pre><code>var viewer = OpenSeadragon({
    id: "openseadragon1",
    prefixUrl: "images/openseadragon/",
    showNavigator:  true,
    navigatorPosition:   "BOTTOM_RIGHT",
    tileSources: '/fcgi-bin/iipsrv.fcgi?Deepzoom=&lt;?=$plink?&gt;.jp2.dzi',
    crossOriginPolicy: 'Anonymous',
    zoomInButton:   "zoom-in",
    zoomOutButton:  "zoom-out",
    homeButton:     "home",
    fullPageButton: "full-page"
});

anno.makeAnnotatable(viewer);

$.ajax({
    url: "handlers/H_AnnotationHandler.php",
    data: "case_id=&lt;?=$case_id?&gt;&amp;plink=&lt;?=$plink?&gt;&amp;mode=get",
    type: "post",
    dataType: "json",
    success: function(response) {
        if (!response.error) {
            for (var i=0; i&lt;response.annots.length; i++) {
                console.log(response.annots[i].comment);
                anno.addAnnotation({
                    text: response.annots[i].comment,
                    shapes: [{
                        type: 'rect',
                        geometry: {
                            x: response.annots[i].rect_x,
                            y: response.annots[i].rect_y,
                            width: response.annots[i].rect_w,
                            height: response.annots[i].rect_h
                        }
                    }]
                });
            }
        } else {
            console.log(response.error);
        }
    }
});
</code></pre>

<p>I can add annotation live : <a href="http://annotorious.github.io/demos/openseadragon-preview.html">http://annotorious.github.io/demos/openseadragon-preview.html</a></p>

<p>After user added the annotation, I store in my database. When the user refresh the page, I am loading saved datas from database using ajax call (<code>H_AnnotationHandler.php</code>). Returning data is true, but I could not draw annotation on jpeg2000 image using <code>anno.addAnnotation</code>, how can I draw it ?</p>

<p>Reference : Add annotations <a href="http://annotorious.github.io/api.html#addAnnotation">API</a>.</p>