Outputting JSON objects to HTML (2 posts)

  1. Kirk Wight
    Theme Wrangler
    Posted 3 years ago #

    Hello all,

    I'm writing a plugin that uses AJAX to update displayed posts as the user checks on filters (I think the term is "faceted search").

    I'm able to get the query object back just fine, according to what I see in the console, but what would be best practices for turning those objects in to the actual posts HTML? Assigning everything to a huge mess of variables seems like overkill, but I don't really know enough about Javascript to know what's best or possible.

    Any ideas?

  2. redrocksrover2
    Posted 3 years ago #

    You should be able to use jQuery's $.getJSON(my.json)

    The jQuery documentation has a few good examples of traversing through the array to output HTML:

    If your URL has a callback function you'll have to use JSONP.

Topic Closed

This topic has been closed to new replies.

About this Topic