1

I'm setting up leaflet bookmarks with a server-based bookmarks store as per 'Custom storage(e.g AJAX)' in the Bookmarks documentation (https://github.com/w8r/Leaflet.Bookmarks).

I'm using a perl PUT handler running under Apache and I'm able to save a bookmark just fine into my '/bookmarks/' folder ('204 OK'), the problem is that I can't get a list of boomarks. It always says 'No Bookmarks Yet' - even if I create a new bookmark in the same session.

The bookmark files themselves seem OK with all the required fields. I have verified that I can retrieve the bookmark files with a GET request with no problem.

function getAllItems works OK and gets a json list of filenames from my server like so:-

{
  "bookmarks": [
    { "file": "filename1" },
    { "file": "filename2" },
    { "file": "filename3" }]
}

Javascript is definately NOT my mother tongue and I'm not sure if the above format is correct or even if reading bookmark files has been fully implemented.

1 Answer 1

1

I finally got it sorted.

  1. "getAllItems" needed the contents of all the bookmark files in one big json, not just the filenames. OK now.
  2. Needed to do "JSON.parse(bookmark.latlng)" at lines 463 and 779 of leaflet.Bookmarks.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.