getJSON problem

getJSON problem

This code does not work
chrome debugger says received an invalid response origin is null therefore not aloud access.
This is the same for both local machine and web host.

<script>
$(document).ready(function(e) {
$.getJSON("JS/testobject.js",function(data){
$.each(data,function(key,val){
$('body').append(key + ":" + val +"<br />");
});
});
});
</script>

The JS/testobject.js file contains the following

var data = [
        {
            "key": "value",
            "key": "value"

        },
        {
            "key": "value",
            "key": "value"
        }
];