Actually i had my code like this

for(var i = 0; i < city_schools.length; i++){ ..... }

But somehow i missed the .length when I posted my message... sorry if it
caused any confusions

I think the problem is that the data is not being stored in the array
properly, or at least I'm not doing it right



On Wed, Jun 15, 2011 at 1:36 PM, John Finlay <fin...@moeraki.com> wrote:

>  On 6/15/11 8:59 AM, jay K. wrote:
>
> Hello,
>
> I apologize for seeming too impatient or rude, actually I'm a bit in a
> hurry because I was given a project
> and was told that it was urgent. I miscalculated how much time it was going
> to take me to learn django
>
> Anyway, what I want to do is to use the variables variables city_schools,
> city_latitudes and city_longitudes
> as javascript arrays in a separate js file
>
> For instance, like this
>
> //INSIDE JAVASCRIPT FILE
>
> ....
>
> for(var i = 0; i < city_schools; i++){
>
>
> shouldn't this be:
>
> for(var i = 0; i < city_schools.length; i++){
>
>
>
>     var lat = city_latitude[i];
>     var long = city_longitude[i];
>
>     googlemap.addmarker(lat, long);
>
>     ......
> }
>
> ....
> //END
>
> The whole point here is to add markers to an existing google map. Somehow
> the variables store the data from django into the js arrays, but
> I am unable to access them they way I want, so I was wondering if I need to
> do anything extra before manipulating the js arrays.
>
> Any suggestions would be welcomed
>
> Thanks, and again sorry for seeming rude/desperate, it was all my fault
>
>
>
>
> On Wed, Jun 15, 2011 at 10:45 AM, Ian Clelland <clell...@gmail.com> wrote:
>
>> On Wed, Jun 15, 2011 at 7:27 AM, jay K. <jay.developer2...@gmail.com>wrote:
>>
>>> Hello,
>>>
>>> I've posted my question before, but I believe I didn't provide enough
>>> detail. I intend to present my issue again, this time with more
>>> detail.
>>>
>>> Let me tell you that I am not a django developer, so I have very
>>> limited exposure to django. I just know html, css, javascript, jquery,
>>> php (also java and c++, so I'm familiar with object-oriented
>>> programming).
>>
>>
>>  ...
>>
>>
>>>
>>> Now, I manage to see the output of the javascript written above
>>> through Firefox's "View - Page Source" and it comes up like this
>>>
>>> //BEGINNING
>>> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>>>
>>> var city_latitudes = ["58","88","25"];
>>>
>>> var city_longtitudes = ["7","99","100"];
>>>
>>> //END
>>>
>>>
>>> I have a separate javascript file where I add the code for the google
>>> map. What I want to do is to be able to access each of the
>>> city_schools, city_latitudes, and city_longitudes and use its data to
>>> I can mark the schools inside a google map. It would be ideal if I
>>> could retrieve the info as if it was a js array, but any method that
>>> works is more than welcome
>>>
>>
>>  What you have is very clearly a JavaScript array, as you asked for the
>> first time you posed this question. In fact, by copying the code, you have
>> produced three JavaScript arrays.
>>
>>  What you haven't done, in this newest version of your question, is show
>> exactly what it is you want. We now have a rough idea of what your models
>> look like, but no idea at all why the JavaScript output you have pasted is
>> insufficient.
>>
>>  You say that you know JavaScript, so what you're going to have to do is
>> come up with a sample of what you'd *like* to see as the template output,
>> and hopefully we can help you with the Django template code to produce that
>> output.
>>
>>  [Also, it really doesn't help to be posting and reposting the same
>> question, just hours apart -- it just looks very impatient]
>>
>> --
>> Regards,
>> Ian Clelland
>> <clell...@gmail.com>
>>   --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@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.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.

Reply via email to