I have the following setup. I've a simple `index.html` being served through apache. It looks like the following.

```
<!DOCTYPE html>
<html lang='en'> <meta http-equiv="content-type" content="text/html; charset=UTF8"> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> </head> <body> <canvas id="myChart"></canvas> <script language="JavaScript" src="/customcharts.js"> </script> </body> </html>

```

All the above does is to try and place a line chart on the browser. It uses `chart.js`. To accomplish this the `customcharts.js` tries to connect to a locally running `django` server. The above html is being served through apache running on port 8080 while django runs on port 8090.

the `customcharts.js` looks as follows

```
function renderChart(data){
    console.log(data)
    console.log(data.labels)
    defaultLabels = data.labels
    defaultData = data.defaultData
    var ctx = document.getElementById("myChart").getContext('2d');
    var myChart = new Chart(ctx, {
    type: 'line',
    data: {
        labels: defaultLabels,
        datasets: [{
        lineTension: 0,
        label: 'Activity Profile',
        data: defaultData,
        }]
    }
    })
}

var endpoint = 'http://localhost:8090/polls/alice/'
var defaultData = []
var defaultLabels = []

$.ajax({
    url: endpoint,
    dataType: "JSONP",
    success: renderChart,
    method: 'GET'
}
);

```

Further, my `django` view is

```
def json_response(func):
    """
    A decorator thats takes a view response and turns it
    into json. If a callback is added through GET or POST
    the response is JSONP.
    """
    def decorator(request, *args, **kwargs):
        objects = func(request, *args, **kwargs)
        if isinstance(objects, HttpResponse):
            return objects
        try:
            data = simplejson.dumps(objects)
            if 'callback' in request.REQUEST:
                # a jsonp response!
                data = '%s(%s);' % (request.REQUEST['callback'], data)
                return HttpResponse(data, "text/javascript")
        except:
            data = simplejson.dumps(str(objects))
        return HttpResponse(data, "application/json")
    return decorator

epoch = datetime.datetime.utcfromtimestamp(0)

r = redis.StrictRedis(host='localhost', port=6379, db=0)
threat_list = ['date', 'categories', 'mix']

@json_response
def index(request, uid):
    print uid
    uid = uid.rstrip('/')
    _key = uid
    retjsondict = {}
    input_keys = [_key + ':' + x for x in threat_list]
    k = input_keys[0]
    retdict = {}
    if r.exists(k):
        retvalue = r.get(k).strip('"')
        xdata_dt = [x.split(':')[0] for x in retvalue.split(' ')]
        ydata_dt = [x.split(':')[1].rstrip(',') for x in retvalue.split(' ')]
        retdict['defaultLabels'] = xdata_dt
        retdict['defaultData'] = ydata_dt
    print retdict
    return JsonResponse(retdict)

```

the `index` is the real view and the `json_response` is a decorator.

However, when I try and view it on a browser using  `<http://localhost>` I get the following error 

> 
> XMLHttpRequest cannot load <http://localhost:8090/polls/alice/>. No
>  'Access-Control-Allow-Origin' header is present on the requested
>  resource. Origin '<http://localhost>' is therefore not allowed access.
> 
> 
> 

Could someone point to me what I'm doing off? 
Any help/pointers appreciated.