Return json formatted entries and include a header for Access-Control-Allow-Origin
You can set the header in Twig with the {% header %} function. Like this:

{% header "Content-Type: application/json; charset=utf-8" %}
{% header "Access-Control-Allow-Origin: *" %}


As to generating the actual json, my favourite is using the prune plugin and do it like this:

{% set myEntries = craft.entries.section('mySection').find() %}

{
    {%- spaceless -%}
    "myEntries": {{ myEntries | prune(['onefield', 'anotherfield']) | json_encode() | raw }},
    {%- endspaceless -%}
}


You could also just loop over all the entries and create the json yourself, but I always get into all sorts of issues with encoding when doing that.

If you're going to do a lot of json requests, you could also look into the Element API plugin from Pixel &amp; Tonic. You'd probably have to set the headers on the webserver level (.htaccess or nginx.conf) though.