Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #40697, comment 3


Ignore:
Timestamp:
05/10/2017 03:24:26 PM (9 years ago)
Author:
JPry
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #40697, comment 3

    initial v1  
    1 As @rmccue mentioned, the URL you're hitting is wrong. You're defining `apiURL` as already containing "wp/v2", yet you're trying to append it again in your script. Written as-is, the URL for the Ajax request will be something like `http://eample.com/wp/v2wp/v2/posts`. This is why you're getting the 404 error. The correct URL would be `http://example.com/wp/v2/posts`.
     1As @rmccue mentioned, the URL you're hitting is wrong. You're defining `apiURL` as already containing "wp/v2", yet you're trying to append it again in your script. Written as-is, the URL for the Ajax request will be something like `http://eample.com/wp-json/wp/v2wp/v2/posts`. This is why you're getting the 404 error. The correct URL would be `http://example.com/wp-json/wp/v2/posts`.