WordPress.org

Ready to get started?Download WordPress

Forums

Outputting JSON objects to HTML (2 posts)

  1. Kirk Wight
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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:
    http://api.jquery.com/jQuery.getJSON/

    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