Question: I have a view.py that looks like this:EDIT: NOW LOOKS LIKE THIS

```
def sessionscheduler(request):
    c = connection.cursor()            
    c.execute("SELECT * FROM meter_schedule WHERE id = 1")
    scheduleArray = []
    for row in c.fetchall():
        data = dict([('lastUpdate',row[1]), ('weekdaysOn',row[2]), ('weekdayChargeRateOffPeriodKwh',row[3]), ('weekdayEveningChargeOn',row[4]), ('weekdayEveningStart',row[5]),
                     ('weekdayEveningDuration',row[6]), ('weekdayDayChargeOn',row[7]), ('weekdayDayStart',row[8]), ('weekdayDayDuration',row[9]), ('weekendsOn',row[10]), 
                     ('weekendChargeRateOffPeriodKWh',row[11]), ('weekendEveningChargeOn',row[12]), ('weekendEveningStart',row[13]), ('weekendEveningDuration',row[14]), 
                     ('weekendDayChargeOn',row[15]), ('weekendDayStart',row[16]), ('weekendDayDuration',row[17])])
        scheduleArray.append((data))
    jscheduleArray = json.dumps(scheduleArray)    
    return render(request, 'sessionscheduler.html', jscheduleArray)

```

using the debugger I can see the variable scheduleArray has all the data I want loaded into it.

How do I access jscheduleArray on load in my .js file?

Answer: 
It is likely that your generated JavaScript is invalid. The simplest approach to exporting data from Python to JS is through JSON.

```
import json
def sessionscheduler(request):
    latest_schedule_update = schedule.objects.all()
    context = {'latest_schedule_update': json.dumps(latest_schedule_update)}
    return render(request, 'sessionscheduler.html', context)

```

And your django-template js

```
<script>
    var latest_schedule_update = {{ latest_schedule_update }};
</script>

```
Don't mix `python` and `javascript` if you're templating a javascript file, make sure to put the values that comes from your server-side/django application in quotation marks.