Returning array of integers as part of json dump, how to access in Javascript

2010-02-13 Thread robinne
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_d

Re: Returning array of integers as part of json dump, how to access in Javascript

2010-02-13 Thread robinne
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 wrote: > I am trying to pass an array of integers from a view to javascript in > an ajax call. > > I know

Re: Returning array of integers as part of json dump, how to access in Javascript

2010-02-13 Thread Daniel Roseman
Unfortunately your question is not clear, and this "clarification" does not really help matters. As far as I can tell, obj.PythonList is already an array. If you do: jArray = [obj.PythonList] then yes, jArray[0] is indeed the whole contents of obj.PythonList. But I don't understand why you want

Re: Returning array of integers as part of json dump, how to access in Javascript

2010-02-14 Thread robinne
Yea, that was it. I guess I wasn't quite clear on what was getting passed back from the ajax call. I didn't realize obj.PythonList was already a javascript array. Thanks for your response, sorry my code wasn't very clear. On Feb 13, 3:10 pm, Daniel Roseman wrote: > Unfortunately your question is