{"action":"opened","issue":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/887","labels_url":"https://api.github.com/repos/WP-API/WP-API/issues/887/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/WP-API/issues/887/comments","events_url":"https://api.github.com/repos/WP-API/WP-API/issues/887/events","html_url":"https://github.com/WP-API/WP-API/issues/887","id":57849877,"number":887,"title":"AJAX: API returns 200 but errors. JSONP issue?","user":{"login":"thenickcox","id":702327,"avatar_url":"https://avatars.githubusercontent.com/u/702327?v=3","gravatar_id":"","url":"https://api.github.com/users/thenickcox","html_url":"https://github.com/thenickcox","followers_url":"https://api.github.com/users/thenickcox/followers","following_url":"https://api.github.com/users/thenickcox/following{/other_user}","gists_url":"https://api.github.com/users/thenickcox/gists{/gist_id}","starred_url":"https://api.github.com/users/thenickcox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thenickcox/subscriptions","organizations_url":"https://api.github.com/users/thenickcox/orgs","repos_url":"https://api.github.com/users/thenickcox/repos","events_url":"https://api.github.com/users/thenickcox/events{/privacy}","received_events_url":"https://api.github.com/users/thenickcox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-16T20:50:10Z","updated_at":"2015-02-16T20:50:10Z","closed_at":null,"body":"I'm trying to get a simple Backbone app working locally based on the posts at a separate domain. I had a feeling I'd run into a JSONP issue because of [this issue](https://github.com/WP-API/WP-API/pull/380). Because this change looks like it was slated for 1.2, and I only had the 1.1.1 version from the WordPress plugin directory, I edited lib/class-wp-json-server.php to serve a content type header of `application/javascript`. (I know it's generally a bad idea to hand-edit plugin files, but I wanted to see if I could get it working.)\r\n\r\nThis fixed the error I was getting in Chrome:\r\n\r\n```\r\nRefused to execute script from XXX because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.\r\n```\r\n\r\nSo I figured I'd write a suuuuper simple Backbone collection and see if I could get the posts from the external URL in the console. In CoffeeScript:\r\n\r\n```\r\n@App =\r\n  Collections: {}\r\n  Models: {}\r\n  Views: {}\r\n\r\n@App.Collections.Posts = Backbone.Collection.extend\r\n  url: 'http://sparkflyphotography.com/wp-json/posts'\r\n\r\n@App.Models.Post = Backbone.Collection.extend\r\n  collection: App.posts\r\n\r\n$ ->\r\n  window.App.posts = new App.Collections.Posts\r\n  window.App.posts.fetch\r\n    type: 'GET'\r\n    dataType: 'jsonp'\r\n    contentType: 'application/javascript'\r\n    success: (data, response, opts) -> console.log data, response, opts\r\n    error: (data, response, opts) -> console.log data, response, opts\r\n```\r\n\r\nI know that this code works because I tried setting the `url` property on the collection to `api.github.com/users/thenickcox`, and logging some attributes of the `JSON` object returned in the response, and it worked as expected. \r\n\r\nWhen I point this to the WP-API endpoint, this code actually calls the `error` callback from `fetch`, but the server responds with a `200`, and the posts are there in the server response, I just can't get to them because they're not in the response parameter from the `error` callback. Since this worked on the GitHub API, it feels like a server issue. (I recognize this could be due to the modification I made.) What am I doing wrong?"}}