You should look for JSONP. What you want the script to return is a callback with data as an argument.
<script id="scr1" src="http://www.example.com/some/action?callback=cb" type="text/javascript></script>
Then the server side will create the contents of the script:
cb( ["hello", "world", "what", "where"] );
cb, .
function cb(data) {
}
, , . , . , API, JSONP. callback . API, , JSON.
FWIW, jQuery API, JSONP.
$.getJSON( 'http://example.com/api/method?callback=?', data, function(result) {
});
post/get/ajax, getJSON . , JSONP (script) , , () .