How do I get content from a specific element by ID with the Rest API?
-
How would I get the content that is within a specific div by ID using the WP Rest API?
I can get the page content of the page with the following:
$( document ).ready(function() { $.ajax({ url: 'httpS://mysite/wp-json/wp/v2/pages/14/', error: function() { $('#info').html('<p>An error has occurred</p>'); }, dataType: 'json', async: false, type: 'GET', success: function(data) { var theContent = data; document.getElementById("nav-wrapper").innerHTML = theContent.content.rendered; } }); });
How would I get the contents of a DIV with an ID=remoteContent on the page that is referenced above?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How do I get content from a specific element by ID with the Rest API?’ is closed to new replies.