germanysbestkeptsecret / Wookmark-jQuery

A jQuery plugin to create a dynamic, multi-column layout.
MIT License
2.64k stars 759 forks source link

example-api showing how to load a local json file? #200

Closed macsupport closed 8 years ago

macsupport commented 9 years ago

Is it possible to have an example for us json-challenged people on how we might configure the example-api index.html file to load local json files rather than from wookmark, as it is now? Would love to get infinite scroll working with this method. I have tried changing the apiURL to my local json file but no luck ( and no errors, surprisingly). Any info would be helpful. Thanks

macsupport commented 9 years ago

So I got this to load a local json file by changing: apiURL = 'http://www.wookmark.com/api/json/popular', to apiURL = 'page + '.json', and dataType: 'jsonp', to dataType: 'json', The issue is that it loads the same json file, "1.json", over and over and never gets to "2.json". Any help would be appreciated to get this to work locally.

Sebobo commented 9 years ago

Hi,

the problem with local json is, that it doesn't work when you open the file locally in a browser and so on. You always the to serve the file from a webserver and this is a problem for people who just want to look through the examples. That's why I also added the server example with a bit of php code in the same folder as the example-api.

Regarding your page number, you have to change that in the loadData function and prepend the current page number to the url.

macsupport commented 9 years ago

True, but I am not interested in local viewing in general ( although Firefox works locally). Not sure what you mean by prepend the page number but at least it points me in a direction.... I was assuming this was for that purpose

// Increment page index for future calls. page++; '

Sebobo commented 8 years ago

Older than 3 months. Closing it. Please open if you still need help.