Support » Plugin: JSON API » Encoding ampersands in URL

  • pentool



    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?


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