REST vs Ajax for gallery?
-
I have a gallery plugin based on the Javascript Lightgallery plugin. Currently I have a single php function that gets the images from the database and echos out the html and javascript.
It’s kind of messy using echo to spit out javascript. The javascript file basically just sets various settings for how the gallery is to look and initializes the gallery. I need php for this part because I have to loop through the “gallery” array and spit out an array of the images into the javascript.
A more appropriate way to do this is probably to use either Ajax or the REST API.
What are the advantages of using one over the other? And in what cases is using AJAX more appropriate than REST?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘REST vs Ajax for gallery?’ is closed to new replies.