Jump to content

[SOLVED] need help figuring out a frustrating error


rndilger

Recommended Posts

Hi, I believe the error I'm receiving is JS related (though it may be php-related). Here is the page that I'm receiving the error on:

 

http://www.indianasheep.com/pages/map.php

 

The error is 'null' is null or not an object and it occurs whether you click on "Show All" or one of the other Member Types.

 

Any suggestions?

 

Ryan

hi,

 

This is the error i get

markers[i] is undefined

 

it means the array markers is not properly set or just empty

also i see this in your js

GDownloadUrl("scripts/markers.php", function(data) {

when i use

http://www.indianasheep.com/pages/scripts/markers.php

i get an 404 error page not found

 

when i use

http://www.indianasheep.com/scripts/markers.php without the pages

i see an xml.

 

so maybe using this(added slash)

GDownloadUrl("/scripts/markers.php", function(data) {

should work

Dj Kat,

 

Thanks for the reply and I apologize for my delay (it's the holidays). I see the error you are referring to (markers is undefined, but I'm still unable to figure out why, exactly, this is the case. I used your suggestion and added the backslash to the scripts/markers.php but this didn't help. What is confusing me is the fact that right now, all the markers are shown on the map with the correct colors. So it appears that everything is working. Moreover, when you click on a map marker, it brings up information that was stored in the markers[] array, so I'm just lost.

 

Any more advice as to what is going on here?

 

As always, thanks!

 

Ryan

Have you alert()'d markers to see what it holds?

 

Well, I used the following code to alert the array:

for (var i=0; i<=markers.length; i++) { alert(markers[i]); }

  and the output can be seen at http://www.indianasheep.com/pages/map.php. Obviously the array is not working, but I'm unable to figure out where it's going wrong.

 

Ryan

Alright, I finally figured it out. The error was due to 1 too many elements being in the array. All I did was change

 

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

 

to

 

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

 

Thanks for the advice!

 

Ryan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.