I am using getJSON to get data from a text file on my server I am providing absolute URL in getJSON request
var server="http://abc.com/text.json"
$.getJSON(server,function(data){
console.log(data);
})
so when I access the site with URL http://abc.com/ I get the JSON values proper but when i access the same site with URL http://www.abc.com/ it shows error
Origin http://www.abc.com is not allowed by Access-Control-Allow-Origin.
both URL pointing to the same page then why the getJSON is behaving differently
you can use