Support » Plugin: JSON API » Posts found but not returned

  • My ajax call to get_category_posts returns the correct information about the category and says that there are a number of posts associated with the category, but the posts array is empty. I have tried this command directly from the browser and it does return all of the correct data, so I suspect that the problem is with my ajax call.

    http://localhost/mkpusa.org/?json=get_category_posts&id=8

    My ajax call looks like this:

    jQuery.ajax({
       type: "post",
       async: true,
       url: url,
       dataType: 'json',
       success: function (results) {
          if (handler !== undefined) {
              handler(results);
          }
       },
       error: function (xhr, textStatus, errorThrown) {
        ...

    What is the correct ajax call to get the data back?

    https://wordpress.org/plugins/json-api/

Viewing 1 replies (of 1 total)
  • To start, I’d remove the

    if (handler !== undefined) {
              handler(results);
    }

    code.

    Replace it with a console.log(results) to see the json data in the browser’s console. From there, you can write $.each() loops to iterate over the object’s data.

Viewing 1 replies (of 1 total)
  • The topic ‘Posts found but not returned’ is closed to new replies.