WordPress.org

Support

Support » Plugins and Hacks » Encoding ampersands in URL

Encoding ampersands in URL

  • 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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Encoding ampersands in URL’ is closed to new replies.