Ad
Shopify - Loading Data From An External REST API In A Liquid Template
I need to load some data (A WordPress Menu) from an external REST API into my Shopify template. I'm assuming I need to use an App proxy to do this. I've looked through the documentation but I'm a little confused as to how to go about this.
Can anyone point me in the right direction?
Ad
Answer
I often use jquery with an ajax call to an api end point that either
- sends me back formatted html
- send me back json data that I parse and form the html via javascript.
jQuery(window).load(function(){ data = {}; jQuery.ajax({ type: 'GET', url: 'https://yourapp.herokuapp.com/yourendpoint.json', data: data, dataType: 'json', success: function(data) { console.log(data); $.each( data, function(i, item) { console.log(item); // do something with your data here }); } }); });
Ad
source: stackoverflow.com
Related Questions
- → I can't convert Json to string [OctoberCms]
- → Uncaught TypeError Illegal invocation when send FormData to ajax
- → Laravel Send URL with JSON
- → how to write react component to construct HTML DOM
- → AJAX folder path issue
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel - bindings file for repositories
- → Good solution to work with rest-api like SPA with redux?
- → getting the correct record in Angular with a json feed and passed data
- → Transformer usage on laravel/dingo API
- → Google options Page not saving - Javascript
- → Ember.js JSON API confusion
- → How can I query Firebase for an equalTo boolean parameter?
Ad