Where and orderby using AJAX, Rest API
-
How do I add where and orderby to:
function fetchPodData(page) { $('#loadingMessage').show(); $.ajax({ url: '/wp-json/pods/teacher', type: 'GET', dataType: 'json', data: { page: page, per_page: 100 }, success: function(data, textStatus, jqXHR) { var totalPages = parseInt(jqXHR.getResponseHeader('X-WP-TotalPages')); podData = podData.concat(data); currentPage++; if (currentPage <= totalPages) { fetchPodData(currentPage); } else { displayPodData(podData); $('#loadingMessage').hide(); } }, error: function(jqXHR, textStatus, errorThrown) { $('#loadingMessage').hide(); // Hide loading message in case of error $('.threeColumn').html('<p>Error fetching Pod data.</p>'); } }); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Where and orderby using AJAX, Rest API’ is closed to new replies.