WordPress.org

Forums

JSON API
Encoding ampersands in URL (2 posts)

  1. pentool
    Member
    Posted 1 year ago #

    Hello,

    I am making an ajax request from a regular html page (NOT php!) to get posts from a WordPress blog:
    $.getJSON("YOUR-URL?json=get_category_posts&category_id=215&count=1&callback=?", ...);

    The html page fails validation because of the ampersands in the URL string. I tried to encode them using '&', '%26' and '\u0026' but all of them fail.

    Using '&' returns a json error: "Include 'id' or 'slug' var in your request."

    Using '%26' or '\u0026' ignores the category id and count variables and returns the default 10 latest post.

    Any ideas how can I correct the URL to make the page pass validation?

    Thanks.

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

  2. pentool
    Member
    Posted 1 year ago #

    Anyone?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • JSON API
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags