I put in wrong variable name: > var PIDS = obj.PackageIDS; //this brings back 3,2 for example, an > array of integers.
should be... var PIDS = obj.PythonList; On Feb 13, 10:10 am, robinne <develo...@computer-shoppe.net> wrote: > I am trying to pass an array of integers from a view to javascript in > an ajax call. > > I know how to return json dump from a View so that javascript can > access it as an object like this: > > VIEW > response_dict = {"PythonList": MyList, "EditType": edittype} > return HttpResponse(simplejson.dumps(response_dict), mimetype='text/ > javascript') > > where MyList is a... python list created by: > MyList = [] > for p in packages: > MyList.append(p.id) > > in javascript, I can access the json by: > var obj = YAHOO.lang.JSON.parse(o.responseText); > var PIDS = obj.PackageIDS; //this brings back 3,2 for example, an > array of integers. > > I cannot get at PIDS as an array in javascript. When I try to convert > to an array, the first item in the array is always all values (3,2) > instead of just the first one (3). The most simplistic attempt at this > was: > > var jArray = [obj.PythonList] > > Any suggestions? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.