WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Encoding ampersands in URL (2 posts)

  1. pentool
    Member
    Posted 9 months 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 8 months ago #

    Anyone?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags